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

PYTHONPATH gets overwritten when running tests #19969

Closed
karthiknadig opened this issue Oct 7, 2022 · 6 comments
Closed

PYTHONPATH gets overwritten when running tests #19969

karthiknadig opened this issue Oct 7, 2022 · 6 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments area-testing bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster reports-wanted Looking for more people with the same issue triage-needed Needs assignment to the proper sub-team

Comments

@karthiknadig
Copy link
Member

karthiknadig commented Oct 7, 2022

Hello, I am facing the same issue. On one computer it works, on another it doesn't. Both run VS Code insiders, updated daily. Both have exact same .vscode/settings.json.

one loads the .env variables correctly in integrated python (python test runnter), the other doesn't.

Any hints for debugging this?

EDIT: also installing python-dotenv does not alleviate this. I can confirm that python-dotenv works (when running pytest from commandline), but when I run the tests using the sidebar, it seems like VS Code is overwriting all env variables with some internal state, hence also resetting PYTHONPATH to "."

Originally posted by @niderhoff in #6891 (comment)

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 7, 2022
@karthiknadig
Copy link
Member Author

@niderhoff Created this new issue to track the problem.

@niderhoff
Copy link

Hi, thanks for doing that. As mentioned in the initial comment, I have both systems ready (one where it is working, one where it is not) so let me know which commands I can run to extract some information from both System in order to debug the issue.

@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug area-environments Features relating to handling interpreter environments area-testing labels Oct 10, 2022
@karrtikr
Copy link

karrtikr commented Nov 7, 2022

Can you provide contents of .env file in your workspace? Try debugging a Python file which prints out PYTHONPATH variable on both systems.

We investigate issues in order based on priority and severity, which includes the impact it has on your ability to use the extension to do productive work, and the number of people affected. If other users come forward and leave a comment demonstrating they are seeing/reproducing the problem then we will raise this issue's priority. Thanks for understanding and the patience!

@karrtikr
Copy link

karrtikr commented Nov 7, 2022

@karthiknadig This doesn't seem to be related to environments but testing itself, so re-assigning.

@karrtikr karrtikr removed their assignment Nov 7, 2022
@karrtikr karrtikr added info-needed Issue requires more information from poster reports-wanted Looking for more people with the same issue labels Nov 7, 2022
@dschultz5197
Copy link

I'm having the same issue where testing is not working within the environment I'm in. In the terminal I can run the pytest command and everything works properly, however the test runner does not seem to accept the environment variables (notably PYTHONPATH) and thus can not find the custom modules I'm trying to test.

@brettcannon
Copy link
Member

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.

@brettcannon brettcannon closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments area-testing bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster reports-wanted Looking for more people with the same issue triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

6 participants