-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
unittest: sys.path
is different when running from terminal vs test UI
#23239
Comments
saw your comment- is it worth trying to figure this out now or wait until we remove the experiment which is currently 1 issue away? |
I think we can ship the plugin. This can be addressed after, I think this might actually turnout to be activated run bug. |
Incredibly, this is now fixed on the latest pre-release I installed just now. Did you change something? |
A test fails due to this: output = subprocess.run("pyrsa-sign", capture_output=True, text=True, encoding="utf-8", shell=True)
# pyrsa-sign' is not recognized as an internal or external command pyrsa-sign sits at env/Scripts/pyrsa-sign.exe (windows machine), however, due to the test runner not appending env (both sites packages and Scripts) to the PATH, it fails to identify this executable. Currently using extensions "Python v2024.6.0" well, I'll just mock this for now, but I can see this being a problem |
Hi @inoa-dmpassy! Could you include your full test? Are you running the subprocess inside your given test? Secondly, what do you mean by not appending env? Are you saying env from you computer or from your specific environment? We should be finding the environment, appending so if you are not seeing a variable you expect then that is a different problem. Thanks |
We have changed some stuff but nothing which I thought changed path- I will look to see if I can also repro the fix |
@eleanorjboyd , yes, I'm running subprocess inside the test, these are the important lines:
here's the tree comand of my currenct active command:
if I run it in debug mode using vscode test runner, it works. |
great info thank you! Sounds like you found the item in the path that is not being added correctly. How do you expect the Scripts path to be added to the python path?What is the setup of yourproject? Just like the tree? Just want to clarify since I am unsure where you are running things from and how that would then impact the python path and why we are missing that specific path for you. |
I'm running on windows This is my project setup
Using ctrl + P -> What I mean by activating the env is calling
I'd expect that the test runner would conform to the |
@karthiknadig, thoughts here on why testing many not be waiting for environment activation? |
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. Happy Coding! |
CWD looks the same. syspath is very different.
From vscode:
From the CLI
Originally posted by @bigjools in #17641 (comment)
The text was updated successfully, but these errors were encountered: