Closed
Description
Type: Bug
Behaviour
Expected vs. Actual
On previous VSCode versions the TestExplorer would display the parametrized tests hanging from the test name's node regardless of this test being part of a test class or not. Since, at least, 2023 June release this is no longer the case and all parametrized tests will be directly appended to the class's tests.
(Perhaps related or consequence of the fix from #21541)
Steps to reproduce:
- Create a python (discoverable) test file
test_dummy.py
. - Add the following code representing a loose test method and a wrapped one (both doing exactly the same):
import pytest
@pytest.mark.parametrize(
"a", [pytest.param(0, id="Fist case for loose test"), pytest.param(1)]
)
def test_simple_dummy(a: int):
assert a == 0
class TestWrapper:
@pytest.mark.parametrize(
"a", [pytest.param(0, id="First case for wrapped test"), pytest.param(1)]
)
def test_dummy(self, a: int):
assert a == 0
- The test cases for the "loose" test method (
test_simple_dummy
) will be correctly visualized in the test explorer, whilst the cases in the wrapped test class will be appended directly to theTestWrapper
node.
Result:
- Expected behavior: the parametrized cases are represented always as individual nodes hanging from their parent test method regardless of the test method being part of a class or not.
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.10.11
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
- Value of the
python.languageServer
setting: Default
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
XXX
User Settings
envFile: "<placeholder>"
languageServer: "Pylance"
testing
• cwd: "<placeholder>"
• pytestArgs: "<placeholder>"
• pytestEnabled: true
experiments
• optInto: ["pythonTestAdapter"]
Extension version: 2024.0.1
VS Code version: Code 1.86.0 (05047486b6df5eb8d44b2ecd70ea3bdf775fd937, 2024-01-31T10:28:19.990Z)
OS version: Windows_NT x64 10.0.19045
Modes:
System Info
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz (12 x 2592) |
GPU Status | 2d_canvas: enabled 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 vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled |
Load (avg) | undefined |
Memory (System) | 31.78GB (20.49GB free) |
Process Argv | --crash-reporter-id 94c5d108-18e9-4299-92c6-89e7bb27f0f0 |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
vscaat:30438848
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30951796
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementst:30887150
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
dsvsc019bcf:30953938
8082a590:30958339
3ef8e399:30949928