You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using pytest to test utilities (CLI) or a mix of API and utility which require setting PYTHONPATH, the current set of affairs is not great:
because pytest_dotenv updates the envvars inside the running process, it's not taken in account by sys.path
since 7.0, pytest has added a pythonpath configuration entry but that only updates sys.path, so subprocesses don't take that into account
So if one wants to avoid having to set the envvar externally, one has to hit their head on that wall until they figure that both is necessary.
Having special support for PYTHONPATH was understandably rejected in python-dotenv (theskumar/python-dotenv#36) but I figure pytest-dotenv is a lot more specific, and having a coherent PYTHONPATH & sys.path in test contexts seems a lot more sensible in the context of pytest-ing.
NB: I also opened an issue to see if the Pytest folks would be willing to update the pythonpath feature such that it'd also update the envvar: pytest-dev/pytest#10067
The text was updated successfully, but these errors were encountered:
When using pytest to test utilities (CLI) or a mix of API and utility which require setting
PYTHONPATH
, the current set of affairs is not great:pytest_dotenv
updates the envvars inside the running process, it's not taken in account bysys.path
pythonpath
configuration entry but that only updatessys.path
, so subprocesses don't take that into accountSo if one wants to avoid having to set the envvar externally, one has to hit their head on that wall until they figure that both is necessary.
Having special support for
PYTHONPATH
was understandably rejected in python-dotenv (theskumar/python-dotenv#36) but I figurepytest-dotenv
is a lot more specific, and having a coherentPYTHONPATH
&sys.path
in test contexts seems a lot more sensible in the context of pytest-ing.NB: I also opened an issue to see if the Pytest folks would be willing to update the pythonpath feature such that it'd also update the envvar: pytest-dev/pytest#10067
The text was updated successfully, but these errors were encountered: