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

Tests need to strip environment variables before running #463

Closed
CyberTailor opened this issue Nov 3, 2024 · 2 comments · Fixed by #464
Closed

Tests need to strip environment variables before running #463

CyberTailor opened this issue Nov 3, 2024 · 2 comments · Fixed by #464
Assignees

Comments

@CyberTailor
Copy link
Contributor

The following tests fail when run by the Portage package manager:

tests/test_settings.py::test_ignore_empty_with_dotenv_when_empty_uses_default
tests/test_settings.py::test_ignore_empty_with_dotenv_when_not_empty_uses_value

They expect ${A} to be unset, while this is one of variables defined by portage.

Relevant section in "Problems faced when downstream testing Python packages":
https://mgorny.pl/articles/downstream-testing-python-packages.html#home-directory-use-config-leakage

@CyberTailor
Copy link
Contributor Author

Some tests also fail with COLUMNS value other than 80, e.g.:

$ COLUMNS=81 pytest -vv "tests/test_source_cli.py::test_cli_help_default_or_none_model"

@hramezani
Copy link
Member

Thanks @CyberTailor for reporting.

Can you make a PR to change these tests?

CyberTailor added a commit to CyberTailor/pydantic-settings that referenced this issue Nov 3, 2024
Tests expect help text to be wrapped at 80 characters.

Issue: pydantic#463
CyberTailor added a commit to CyberTailor/pydantic-settings that referenced this issue Nov 3, 2024
Certain variables, when set in the running environment, can make tests
fail. As environment variable names are case-insensitive by default,
it's better to start with a clean environment.

Issue: pydantic#463
CyberTailor added a commit to CyberTailor/pydantic-settings that referenced this issue Nov 3, 2024
CyberTailor added a commit to CyberTailor/pydantic-settings that referenced this issue Nov 3, 2024
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