pytest-dotenv
pytest-dotenv copied to clipboard
How to use pytest-dotenv only on integration test?
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"?