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

How to use pytest-dotenv only on integration test? #26

Open
gsemet opened this issue Jul 27, 2023 · 0 comments
Open

How to use pytest-dotenv only on integration test? #26

gsemet opened this issue Jul 27, 2023 · 0 comments

Comments

@gsemet
Copy link

gsemet commented Jul 27, 2023

Hello

pytest-dotenv is very interesting for loading dotenv for integration tests (ie test that depends on the environment), for example to simulate the test environments in CI.

But this approach shall not be used for unit test that shall mock/stub/patch every dependency to outside, and typically the environment variable shall be simulated by something like monkeypatch.setenv. This is the I in FIRST principles (https://medium.com/@tasdikrahman/f-i-r-s-t-principles-of-testing-1a497acda8d6)

How we can restrict pytest-dotenv to only tests marked as "integration_tests"?

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

No branches or pull requests

1 participant