-
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
test explorer cannot import .env #21632
Comments
Hello! Will investigate now- in the meantime could you send your full logs from the python output? I want to see if the experiment related to testing is turned on. Thanks |
The OUTPUT info is: 2023-07-16 14:42:09.590 [info] Experiment 'pythonPromptNewFormatterExt' is active 2023-07-16 14:42:21.380 [info] > /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2023.12.0/pythonFiles/unittestadapter/discovery.py --port 58101 --uuid 1c1ec181-2296-4760-8483-09ddb1ae2633 --udiscovery -v -s ./tests -p *test.py |
Thank you! Yes it looks like you are on the new testing rewrite and this is why you saw a change in behavior since we just moved to this experiment to a larger group of people receiving it. You can opt out of the rewrite as I get this fix in by setting this in your user settings: |
Hi! I gave this a try and downgraded to version |
since #21640 has more comments and seems to be the same issue closing this as a dup of that one. But thank you for the minimal repro as I used that. Please jump to the other thread and add your comments, I just put my most recent comment from this thread in there regarding being unable to repro. |
reopening as it is a different error message from the other one |
This solved my problem, thx! |
works on v2023.8.0 |
Hi! Following up, from my understanding unittest does not actually inherit from the .env file automatically and something like this code below is used to get the envvars. If you have a reference saying that unittest should inherit from .env please re-open this issue. Thanks!
|
Type: Bug
I created the .env file and defined the PYTHONPATH environment variable in my Python project. When I used test explorer to run test case, I got the failure
Failed to import test module:helloworld_test
in OUTPUT whenPython extension for Visual Studio Code
version was 2023.12.0, 2023.10.1, 2023.10.0. it will not fail in other lower versions of the extension.My project directory is:
setting.json is:
src/helloworld.py is:
tests/helloworld_test.py is:
.env is
Behaviour
Expected vs. Actual
Actual
report an error:
Expected:
discovery the testcase successfully in test explorer
Steps to reproduce:
Extension version: 2023.12.0
VS Code version: Code 1.80.1 (74f6148eb9ea00507ec113ec51c489d6ffb4b771, 2023-07-12T17:20:23.298Z)
OS version: Darwin x64 22.4.0
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: