Skip to content

Support pytest-describe in testing rewrite #21705

@QuentinFchx

Description

@QuentinFchx

Type: Bug

Behaviour

Expected vs. Actual

With the following dependencies:

"pytest==7.4.0" "pytest-describe==2.1.0" 

Considering the following test file:

# test_pytest_describe.py def describe_A(): def test_1(): pass def test_2(): pass def describe_B(): def test_1(): pass def test_2(): pass

When discovering tests (with the new adapter, "python.experiments.optInto": ["pythonTestAdapter"]), only the last describe block is registered, here describe_B.
By "registered", I mean :

  • displayed in the tests explorer
  • having a "run/debug test" quick action in the editor

Neither the describe_A block, nor its tests appear anywhere. FWIW, I tested with different test names, not conflicting between describe blocks (describe_B, test_3/test_4 instead of test_1/test_2), the issue sill occurs.

Screenshots Screenshot 2023-07-28 at 14 16 55 Screenshot 2023-07-28 at 14 16 42

In the Output for Python section below, I added an extract of the test collection output which includes the describe_A block. I assume it means the test collection works well but there is an issue down the line?

Steps to reproduce:

  1. See above

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.16
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Pylance
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

collected xx items <Package test> [...] <Module test_pytest_describe.py> <DescribeBlock 'describe_A'> <Function test_1> <Function test_2> <DescribeBlock 'describe_B'> <Function test_1> <Function test_2> [...] 

User Settings

Multiroot scenario, following user settings may not apply: venvPath: "<placeholder>" languageServer: "Pylance" linting • flake8Enabled: true • mypyArgs: "<placeholder>" • mypyEnabled: true formatting • provider: "black" • blackArgs: "<placeholder>" testing • autoTestDiscoverOnSaveEnabled: false experiments • optInto: ["pythonTestAdapter"] 

Extension version: 2023.12.0
VS Code version: Code 1.80.2 (Universal) (2ccd690cbff1569e4a83d7c43d45101f817401dc, 2023-07-27T21:05:41.366Z)
OS version: Darwin arm64 22.5.0
Modes:

System Info
Item Value
CPUs Apple M1 (8 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 3, 3, 2
Memory (System) 16.00GB (0.07GB free)
Process Argv
Screen Reader no
VM 0%

Metadata

Metadata

Assignees

Labels

area-testingcommunity askFeature request that the community expressed interest infeature-requestRequest for new features or functionalityneeds PRReady to be worked onverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions