Issue Type: Bug
If %PYTHONPATH% is set, VSC test (pytest) plugin double %PYTHONPATH% in debug configuration. Not the case with run configuration.
Example (run):
test_example.py::test_printPythonPath
%PYTHONPATH%:
PYTHONPATH_ENV_VAR
PASSED
Example (debug):
test_example.py::test_printPythonPath
%PYTHONPATH%:
PYTHONPATH_ENV_VAR
PYTHONPATH_ENV_VAR
PASSED
Doesn't really affect my use case, but I consider this as a bug.
Extension version: 2020.8.105045
VS Code version: Code 1.48.2 (a0479759d6e9ea56afa657e454193f72aef85bd0, 2020-08-25T10:13:11.295Z)
OS version: Windows_NT x64 10.0.19041
System Info
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 x 3193)|
|GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled|
|Load (avg)|undefined|
|Memory (System)|15.89GB (6.95GB free)|
|Process Argv|vsCodeTest.code-workspace|
|Screen Reader|no|
|VM|0%|
@schperplata I can reproduce this when I set environment variables using .env file, and print environment variables to file, thanks! Btw how were you setting environment variables?
In this specific case, I have a .bat file that set PYTHONPATH and open VSC workspace. I figured out this is the simplest way of configuring VSC workspace without mulitplying source paths for pylint, pylance, autocomplete, ...
Anyway, I don't know if that happened before when we also used .env files.
Can you please elaborate on what you mean by multiplying source paths?
In this specific case, I have a .bat file that set PYTHONPATH and open VSC workspace.
Does this issue happen when you set PYTHONPATH using a .bat file as well?
Can you please elaborate on what you mean by multiplying source paths?
This is a problem when multiroot workspaces/projects are used or modules anywhere in the project tree must be runnable. If %PYTHONPATH% is set globaly, for example by .bat file, all _extensions_ /VSCode tools can make use of it (Pylance, Pylint, Pytest, ...). All paths are defined at one single place (.bat/.env). Otherwise, user must configure these paths for extensions, for example Pylance "python.analysis.extraPaths". This was already a discussion on a couple of other places, here is one example. Anyway, don't be bothered with this, as it is not the problem here (at least I think so) :)
Does this issue happen when you set PYTHONPATH using a .bat file as well?
Yes. In fact, this is the way I initially discovered (and reported) the issue.