Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.6.1: pytest fails #461

Closed
kloczek opened this issue Nov 1, 2024 · 2 comments · Fixed by #491
Closed

2.6.1: pytest fails #461

kloczek opened this issue Nov 1, 2024 · 2 comments · Fixed by #491
Assignees

Comments

@kloczek
Copy link

kloczek commented Nov 1, 2024

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using installer module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pydantic-settings-2.6.1-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pydantic-settings-2.6.1-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.2.2, pluggy-1.5.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pydantic-settings-2.6.1
configfile: pyproject.toml
testpaths: tests
plugins: examples-0.0.13, mock-3.14.0
collected 361 items / 1 error

========================================================================================== ERRORS ===========================================================================================
___________________________________________________________________ ERROR collecting tests/test_source_azure_key_vault.py ___________________________________________________________________
tests/test_source_azure_key_vault.py:32: in <module>
    class TestAzureKeyVaultSettingsSource:
tests/test_source_azure_key_vault.py:118: in TestAzureKeyVaultSettingsSource
    def _raise_resource_not_found_when_getting_parent_secret_name(self, secret_name: str) -> KeyVaultSecret:
E   NameError: name 'KeyVaultSecret' is not defined
================================================================================== short test summary info ==================================================================================
ERROR tests/test_source_azure_key_vault.py - NameError: name 'KeyVaultSecret' is not defined
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===================================================================================== 1 error in 1.62s ======================================================================================
List of installed modules in build env:
Package            Version
------------------ -------------
annotated-types    0.7.0
black              24.4.2
build              1.2.2.post1
click              8.1.7
distro             1.9.0
exceptiongroup     1.1.3
hatchling          1.25.0
importlib_metadata 8.5.0
iniconfig          2.0.0
installer          0.7.0
mypy_extensions    1.0.0
packaging          24.0
pathspec           0.12.1
platformdirs       4.3.6
pluggy             1.5.0
pydantic           2.9.2
pydantic_core      2.23.4
pyproject_hooks    1.2.0
pytest             8.2.2
pytest-examples    0.0.13
pytest-mock        3.14.0
python-dateutil    2.9.0.post0
python-dotenv      1.0.1
tokenize_rt        6.1.0
tomli              2.0.1
trove-classifiers  2024.10.21.17
typing_extensions  4.12.2
wheel              0.44.0
zipp               3.20.2

Please let me know if you need more details or want me to perform some diagnostics.

@CyberTailor
Copy link
Contributor

This test requires installing additional dependencies, use --ignore tests/test_source_azure_key_vault.py to deselect it.

Maybe it should be conditionally skipped (e.g. with pytest.importorskip()).

@hramezani
Copy link
Member

Fixed in #491

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants