-
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
Empty string environment variables are not included during tests #22337
Comments
Hello! Can you try this on the testing rewrite and let me know if it still exists? To do so add this setting to your users You can confirm you have the rewrite enabled by setting Let me know if the rewrite fixes your issue. Thanks! |
Another note, we do not run anything in a shell for testing so we will not pick up the
|
Hi @eleanorjboyd, thanks for the responses!
confirming
🤔 I considered this as well, that's why I included test cases for the negative scenario
Yeah, tried |
hm yes good point, @karrtikr or @karthiknadig thoughts on why one exists and the other doesn't and also why Also @Zhong-z was there a reason you were using your |
That is strange indeed, maybe VS Code filters out the empty variables, logs should indicate which variables are included when launching tests. |
The script/code snippet was simplified for reproducing. In my actual setup/use case, the ENV variables were setup in zshrc/shell is because they are shared between multiple repos/projects (different languages) locally, and they are subjective to change independently. I could technically use a |
Thanks @karrtikr . I couldn't see the empty string ENVs are included in the 'printEnvVariables.py` output at all, so I assume they are not included.
|
@Zhong-z You could add |
Thanks all. It appears that the issue is indeed related to VS Code in general and is not specific to the Python extension. 😄 |
Glad you were able to find the root there- sorry there is nothing we can do to help! Closing this issue as the issue on core will keep track of status and progress. Thanks! |
Great job finding the upstream issue! FYI #22337 (comment) should still help your case. |
Behaviour
Expected vs. Actual
Expected:
Empty string environment variables are loaded/included when running tests using the extension.
Actual
Empty string environment variables lost completely.
Steps to reproduce:
Run the following tests (defined in file
test_os_environ.py
) in vscode 'testing', configured with pytest,tests with empty string environment fails
and run
pytest
via CLI, all tests passedDiagnostic data
python.languageServer
setting: DefaultOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
The text was updated successfully, but these errors were encountered: