Skip to content

PyTest test that fails teardown shows as succeeded #25723

@garyvdm

Description

@garyvdm

Type: Bug

Behaviour

A test that fails in teardown is considered as failed by pytest, but succeeded by vscode-python

Steps to reproduce:

Run the following test in vscode:

from pytest import fixture


@fixture
def fixture_fail_teardown():
    yield
    assert False


def test_fail_teardown(fixture_fail_teardown):
    pass

Current Results:

Test shows as passed/succeeded in the test results panel.

Image

Expected Results:

Test should show as failed.

System details:

Extension version: 2026.0.0
VS Code version: Code 1.108.0 (94e8ae2b28cb5cc932b86e1070569c4463565c37, 2026-01-08T13:53:10.781Z)
OS version: Linux x64 6.17.12-300.fc43.x86_64
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.14.0.final.0
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): System
  • Value of the python.languageServer setting: Pylance
User Settings


languageServer: "Pylance"

testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true

experiments
• optInto: ["pythonTestAdapter"]

Installed Extensions
Extension Name Extension Id Version
code-spell-checker str 4.4.0
debugpy ms- 2025.18.0
EditorConfig Edi 0.17.4
even-better-toml tam 0.21.2
git-graph-3 Gxl 1.35.0
js-debug ms- 1.105.0
js-debug-companion ms- 1.1.3
just ske 2.0.0
live-server ms- 0.4.16
prettier-sql-vscode inf 1.6.0
prettier-vscode esb 11.0.2
python ms- 2026.0.0
remote-containers ms- 0.437.0
remote-ssh ms- 0.122.0
ruff cha 2026.34.0
vscode-js-profile-table ms- 1.0.10
vscode-pylance ms- 2025.10.4
vscode-python-envs ms- 1.16.0
vscode-systemd-support han 3.0.0
System Info
Item Value
CPUs AMD Ryzen 7 5700X 8-Core Processor (16 x 4639)
GPU Status 2d_canvas: enabled
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) 1, 1, 1
Memory (System) 31.24GB (20.61GB free)
Process Argv --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform-hint=auto --crash-reporter-id 95ae8d4b-9deb-4a61-9da2-1f84bb69139b
Screen Reader no
VM 0%
DESKTOP_SESSION gnome
XDG_CURRENT_DESKTOP GNOME
XDG_SESSION_DESKTOP gnome
XDG_SESSION_TYPE wayland
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
9hi5e907:31436603
aj953862:31281341
6abeh943:31336334
envsactivate1:31353494
cloudbuttont:31379625
3efgi100_wstrepl:31403338
use-responses-api:31390855
ec5jj548:31422691
terminalsuggestenabled:31431119
cp_cls_t_966_ss:31442352
c0683394:31419495
478ah919:31426797
a5gib710:31434435
7a04d226_do_not_restore_last_panel_session:31438103
anthropic_thinking_t:31432745
h0hdh950:31428394
cp_cls_c_1081:31443829
nes-set-to-on:31441941
a43f0574:31442827

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-neededNeeds assignment to the proper sub-team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions