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
When setting "python.testing.cwd": "${workspaceFolder}/src" the testing of python code using the VSCode Testing feature does not work. The indicators for the tests are gray circles, not green ticks or red x. The discovery of tests works. Debugging a test does not work. I get this in Test Results:
Running tests (pytest): /Users/cornelius/Repositories/Debug-Pytest/tests/test_main.py::test_main[1-2-3]
Running test with arguments: --rootdir /Users/cornelius/Repositories/Debug-Pytest/src --override-ini junit_family=xunit1 --junit-xml=/var/folders/z3/mfjy6_6n4lb5lpr3wz1f009h0000gn/T/tmp-28532jOG4caOuJzkq.xml --capture no ./test_main.py::test_main[1-2-3]
Current working directory: /Users/cornelius/Repositories/Debug-Pytest/src
Workspace directory: /Users/cornelius/Repositories/Debug-Pytest
Run completed, parsing output
Error while running tests: 1-2-3
TypeError: Cannot read properties of undefined (reading 'length')
Error while running tests:
TypeError: Cannot read properties of undefined (reading 'length')
Finished running tests!
In the debug console it prints:
============================= test session starts ==============================
platform darwin -- Python 3.12.2, pytest-8.3.2, pluggy-1.5.0
rootdir: /Users/cornelius/Repositories/Debug-Pytest/src
configfile: ../pyproject.toml
plugins: hydra-core-1.3.2
collected 0 items
- generated xml file: /var/folders/z3/mfjy6_6n4lb5lpr3wz1f009h0000gn/T/tmp-28532jOG4caOuJzkq.xml -
============================ no tests ran in 0.00s =============================
ERROR: file or directory not found: ./test_main.py::test_main[1-2-3]
Removing "python.testing.cwd": "${workspaceFolder}/src" makes it work. However, I require the cwd to be set to src/ during testing.
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
Output Panel Empty:
Extension version: 2024.12.3
VS Code version: Code 1.92.1 (eaa41d57266683296de7d118f574d0c2652e1fc4, 2024-08-07T20:16:39.455Z)
OS version: Darwin arm64 23.5.0
Modes:
Connection to 'ssh-remote+7b22686f73744e616d65223a22544f52524e4f44453134227d' could not be established
Python version (& distribution if applicable, e.g. Anaconda): 3.12.2
Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
Value of the python.languageServer setting: Default
User Settings
Multiroot scenario, following user settings may not apply:
languageServer: "Pylance"
testing
• cwd: "<placeholder>"
• pytestArgs: "<placeholder>"
• pytestEnabled: true
Type: Bug
Behaviour
When setting
"python.testing.cwd": "${workspaceFolder}/src"
the testing of python code using the VSCodeTesting
feature does not work. The indicators for the tests are gray circles, not green ticks or red x. The discovery of tests works. Debugging a test does not work. I get this inTest Results
:In the debug console it prints:
Removing
"python.testing.cwd": "${workspaceFolder}/src"
makes it work. However, I require thecwd
to be set tosrc/
during testing.Steps to reproduce:
Create a folder with this structure:
and fill with these contents:
src/main.py
src/utils.py
tests/test_main.py
Debug-PyTest.code-workspace
pyproject.toml
.vscode/settings.json
Diagnostic data
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output Panel Empty:
Extension version: 2024.12.3
VS Code version: Code 1.92.1 (eaa41d57266683296de7d118f574d0c2652e1fc4, 2024-08-07T20:16:39.455Z)
OS version: Darwin arm64 23.5.0
Modes:
Connection to 'ssh-remote+7b22686f73744e616d65223a22544f52524e4f44453134227d' could not be established
python.languageServer
setting: DefaultUser Settings
Installed Extensions
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Connection to 'ssh-remote+7b22686f73744e616d65223a22544f52524e4f44453134227d' could not be established
The text was updated successfully, but these errors were encountered: