Repository navigation
failing pytest tests are marked as “success” when some of the subtests succeeded #25824
Copy link
Copy link
Open
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onReady to be worked on
Description
Type: Bug
Behaviour
See title, see #24455
what I expect instead
test_subtests should be marked as failed as the CLI shows (pytest itself isn’t buggy and shows things as expected):
Steps to reproduce:
def test_subtests(subtests):
with subtests.test("success"):
assert True
with subtests.test("failure"):
pytest.fail("subtest failure")- install pytest >=9
- run the above test in the test sidebar
- see buggy results as described and shown above
Diagnostic data
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
2026-02-28 11:47:00.075 [info] Attempting to use temp directory for test ids file, file name: test-ids-c9c0405040b5fbf605e6.txt
2026-02-28 11:47:00.084 [info] Environment variables set for pytest execution: PYTHONPATH=/home/phil/.vscode/extensions/ms-python.python-2026.2.0-linux-x64/python_files, TEST_RUN_PIPE=/run/user/1000/python-test-results-31b84a1d4f7f94f5a051, RUN_TEST_IDS_PIPE=/run/user/1000/test-ids-c9c0405040b5fbf605e6.txt
2026-02-28 11:47:00.084 [info] Running pytest with arguments: /home/phil/.vscode/extensions/ms-python.python-2026.2.0-linux-x64/python_files/vscode_pytest/run_pytest_script.py for workspace /home/phil/Dev/Python/test
2026-02-28 11:47:00.084 [info] > …/python ~/.vscode/extensions/ms-python.python-2026.2.0-linux-x64/python_files/vscode_pytest/run_pytest_script.py
2026-02-28 11:47:00.084 [info] cwd: .
2026-02-28 11:47:03.400 [info] Test Result named pipe /run/user/1000/python-test-results-31b84a1d4f7f94f5a051 cancelled
Extension version: 2026.2.0
VS Code version: Code 1.109.5 (072586267e68ece9a47aa43f8c108e0dcbf44622, 2026-02-19T19:43:32.382Z)
OS version: Linux x64 6.18.13-arch1-1
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.14.3
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Hatch
- Value of the
python.languageServersetting: Pylance
User Settings
languageServer: "Pylance"
testing
• pytestArgs: "-vv"
• pytestEnabled: true
experiments
• optInto: ["pythonTestAdapter"]
Installed Extensions
| Extension Name | Extension Id | Version |
|---|---|---|
| 2077-theme | End | 1.5.3 |
| biome | bio | 3.4.1 |
| cmake-tools | ms- | 1.22.28 |
| code-spell-checker | str | 4.5.6 |
| code-spell-checker-german | str | 2.3.4 |
| codeium | Cod | 1.48.2 |
| cpp-devtools | ms- | 0.2.0 |
| datawrangler | ms- | 1.24.0 |
| debugpy | ms- | 2025.18.0 |
| dependi | fil | 0.7.21 |
| EditorConfig | Edi | 0.18.1 |
| editorconfiggenerator | nep | 0.2.1 |
| errorlens | use | 3.28.0 |
| even-better-toml | tam | 0.21.2 |
| gc-excelviewer | Gra | 4.2.64 |
| git-graph | mhu | 1.30.0 |
| jinjahtml | sam | 0.20.0 |
| js-debug | ms- | 1.105.0 |
| js-debug-companion | ms- | 1.1.3 |
| jupyter | ms- | 2025.9.1 |
| jupyter-keymap | ms- | 1.1.2 |
| jupyter-renderers | ms- | 1.3.2025062701 |
| live-server | ms- | 0.4.17 |
| markdown-checkbox | bie | 0.4.0 |
| markdown-mermaid | bie | 1.32.0 |
| myst-highlight | Exe | 0.11.0 |
| myst-tml-syntax | chr | 0.1.3 |
| tom | 1.2.2 | |
| pre-commit-vscode | Mar | 0.1.0 |
| python | ms- | 2026.2.0 |
| rainbow-csv | mec | 3.24.1 |
| remote-containers | ms- | 0.442.0 |
| remote-explorer | ms- | 0.5.0 |
| remote-ssh | ms- | 0.122.0 |
| remote-ssh-edit | ms- | 0.87.0 |
| ruff | cha | 2026.36.0 |
| RunOnSave | eme | 1.0.3 |
| shades-of-purple | ahm | 7.3.6 |
| simple-rst | tro | 1.5.4 |
| simply-view-image-for-python-debugging | ela | 4.0.10 |
| string-converter | ada | 0.1.2 |
| synthwave-vscode | Rob | 0.1.20 |
| test-adapter-converter | ms- | 0.2.1 |
| todo-tree | Gru | 0.0.226 |
| toml | be5 | 0.6.0 |
| vscode-ansi | ili | 1.1.7 |
| vscode-dask | joy | 0.0.4 |
| vscode-github-actions | git | 0.31.0 |
| vscode-graphql | Gra | 0.13.2 |
| vscode-graphql-syntax | Gra | 1.3.8 |
| vscode-js-profile-table | ms- | 1.0.10 |
| vscode-jupyter-cell-tags | ms- | 0.1.9 |
| vscode-jupyter-slideshow | ms- | 0.1.6 |
| vscode-language-pack-de | MS- | 1.108.2026021109 |
| vscode-mogami | nin | 0.1.9 |
| vscode-nushell-lang | The | 1.10.0 |
| vscode-open | san | 0.3.0 |
| vscode-pull-request-github | Git | 0.128.0 |
| vscode-pylance | ms- | 2026.1.100 |
| vscode-svg-previewer | vit | 0.7.0 |
| vscode-yaml | red | 1.21.0 |
| vscode-zipfs | arc | 3.0.0 |
| xml | Dot | 2.5.1 |
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 7 3700X 8-Core Processor (16 x 3379) |
| GPU Status | 2d_canvas: enabled GPU0: VENDOR= 0x1002 [Google Inc. (AMD)], DEVICE=0x73bf [ANGLE (AMD, AMD Radeon RX 6800 XT (radeonsi navi21 ACO), OpenGL ES 3.2 Mesa 26.0.1-arch1.1)], DRIVER_VENDOR=Mesa, DRIVER_VERSION=26.0.1 ACTIVE Machine model name: Machine model version: 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 trees_in_viz: disabled_off video_decode: enabled video_encode: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off webnn: disabled_off |
| Load (avg) | 3, 2, 2 |
| Memory (System) | 31.26GB (19.68GB free) |
| Process Argv | --crash-reporter-id e73710ca-22af-43b0-a2f6-ea09b8305a53 |
| Screen Reader | no |
| VM | 0% |
| DESKTOP_SESSION | plasma |
| XDG_CURRENT_DESKTOP | KDE |
| XDG_SESSION_DESKTOP | KDE |
| XDG_SESSION_TYPE | wayland |
A/B Experiments
vsliv368cf:30146710
pythonvspyt551:31249599
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
6abeh943:31336334
envsactivate1:31464700
cloudbuttont:31379625
3efgi100_wstrepl:31403338
use-responses-api:31390855
je187915:31454425
ec5jj548:31422691
cp_cls_t_966_ss:31454198
4je02754:31466945
find_all_ref_in_bg_f:31469307
a5gib710:31434435
38bie571_auto:31426784
7a04d226_do_not_restore_last_panel_session:31438103
cp_cls_t_1081:31454832
a43f0574a:31442826
e9c30283:31461165
idci7584:31464702
edit_mode_hidden:31461530
3bj34942:31461205
864ei723_large_tool_results_to_disk:31460878
7ef87755:31458076
chat:31457767
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onReady to be worked on
Activity
jaap3 commentedon Mar 5, 2026
Seeing the same: crosslinking pytest-dev/pytest-subtests#184 which was originally created by Eleanor Boyd (@eleanorjboyd) in the now archived pytest-subtests repository
jaap3 commentedon Mar 5, 2026
For now it is possible to disable subtests in vscode using the following snippet (inspired by the workaround in the pytest-subtests issue)
loic-simon commentedon May 15, 2026
Another workaround, that allows subtests to work and report a failure if any subtest failed:
That work because subtests are (AFAIK) the only time where reports are generated while the item is still running, so we detect that and alter the reported nodeid, so VSCode doesn't take it as the item result, but wait for the final result.
I made this quickly by playing with pytest hooks, I can't guarantee there are no side-effects, but so far it worked great!
amesser-hilscher commentedon Jul 3, 2026
This breaks junit output of pytest and probably even more. Tests without subtest now show up twice in junit xml files here.