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

Special casing PYTHONPATH in pytest-dotenv? #23

Open
xmo-odoo opened this issue Jun 22, 2022 · 0 comments
Open

Special casing PYTHONPATH in pytest-dotenv? #23

xmo-odoo opened this issue Jun 22, 2022 · 0 comments

Comments

@xmo-odoo
Copy link

xmo-odoo commented Jun 22, 2022

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

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