How to specify in pytest.ini that a .env file should be respected? #9261
-
I have a git repo with a src/ subfolder that has all my code and a tests/ subfolder next to it that stores the tests. I created a However if I run How to configure the pytest.ini so that simply running pytest will work, without manually adding the src/ folder to the path in conftest.py? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
pytest core doesn't come with any support for If this is just about |
Beta Was this translation helpful? Give feedback.
pytest core doesn't come with any support for
.env
files - but there are plugins which add that functionality, such as pytest-dotenv or pytest-env.If this is just about
PYTHONPATH
, there's also pytest-pythonpath and pytest-srcpaths, with native support of apythonpath
setting being added to pytest 7.0.0 soon (see #9134).