You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extension version (available under the Extensions sidebar): 2020.5.86398
OS and version: Linux Mint
Python version (& distribution if applicable, e.g. Anaconda): 3.7.4
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pyenv
Relevant/affected Python packages and their versions: pytest 5.4.3
Expected behaviour
Running a Python test (using pytest) via a Code Lense should run the correct test file while starting from inside the directory specified via python.testing.cwd
Actual behaviour
Execution fails as it tries to execute the test file with a path relative to the root dir not the cwd.
Steps to reproduce:
Set "python.testing.cwd": "${workspaceFolder}/test" and make sure pytest is selected ("python.testing.pytestEnabled": true)
Create a simple test/test_foo.py file containing any test, e.g.:
deftest_foo():
assert1==1
Run via code lense after test discovery via pytest
Logs
Error shown in the Output pane is:
Error: Error: cannot open file:///home/alex/project/test/test/test_foo.py. Detail: Unable to read file '/home/alex/project/test/test/test_foo.py' (Error: Unable to resolve non-existing file '/home/alex/project/test/test/test_foo.py')
Strangely using the "Run all tests" does work but it does show the same error after successfully running.
Use case: Python adds the CWD to PYTHONPATH which is unwanted in this case as it would pick up a wrong folder.
The text was updated successfully, but these errors were encountered:
Environment data
Expected behaviour
Running a Python test (using pytest) via a Code Lense should run the correct test file while starting from inside the directory specified via
python.testing.cwd
Actual behaviour
Execution fails as it tries to execute the test file with a path relative to the root dir not the cwd.
Steps to reproduce:
"python.testing.cwd": "${workspaceFolder}/test"
and make sure pytest is selected ("python.testing.pytestEnabled": true
)test/test_foo.py
file containing any test, e.g.:Logs
Error shown in the Output pane is:
Strangely using the "Run all tests" does work but it does show the same error after successfully running.
Use case: Python adds the CWD to
PYTHONPATH
which is unwanted in this case as it would pick up a wrong folder.The text was updated successfully, but these errors were encountered: