Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Explorer unpack parametrize tests #22914

Closed
Wintreist opened this issue Feb 14, 2024 · 1 comment
Closed

Test Explorer unpack parametrize tests #22914

Wintreist opened this issue Feb 14, 2024 · 1 comment
Assignees
Labels
area-testing info-needed Issue requires more information from poster

Comments

@Wintreist
Copy link

Type: Bug

Behaviour

Expected vs. Actual

Tests marked parametrize are expected to be collapsed to the test name, and if you expand them, then there are tests with specific parameters inside them

Test Explorer expands tests marked paramterize

Steps to reproduce:

  1. Create the file test_something.py
  2. insert the following code into it:
import pytest
class TestSomething:
    @pytest.mark.parametrize("arg", [1, 2, 3])
    def test_one(self, arg):
        pass
    @pytest.mark.parametrize("arg", [1, 2, 3])
    def test_three(self, arg):
        pass
@pytest.mark.parametrize("arg", [1, 2, 3])
def test_two(arg):
    pass

image

  1. With the test_two function the test explorer behaves as it should, but with functions inside a class it doesn't, the same behavior is expected for functions inside classes as well

Diagnostic data

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

2024-02-14 09:47:09.791 [info] Discover tests for workspace name: source - uri: c:\Users\ITV\source\test_something.py
2024-02-14 09:47:09.792 [info] Running discovery for pytest using the new test adapter.
2024-02-14 09:47:09.871 [info] > D:\Autotests\ROBO\Python\python.exe -m pytest -p vscode_pytest --collect-only .
2024-02-14 09:47:09.871 [info] cwd: .
2024-02-14 09:47:10.474 [info] ============================= test session starts =============================
platform win32 -- Python 3.12.2, pytest-8.0.0, pluggy-1.4.0

2024-02-14 09:47:10.477 [info] rootdir: c:\Users\ITV\source
plugins: allure-pytest-2.13.2, anyio-4.2.0

2024-02-14 09:47:10.487 [info] collected 9 items

<Dir source>
  <Module test_something.py>
    <Class TestSomething>
      <Function test_one[1]>
      <Function test_one[2]>
      <Function test_one[3]>
      <Function test_three[1]>
      <Function test_three[2]>
      <Function test_three[3]>
    <Function test_two[1]>
    <Function test_two[2]>
    <Function test_two[3]>

2024-02-14 09:47:10.492 [info] Test server connected to a client.
2024-02-14 09:47:10.493 [info] ResultResolver EOT received for discovery.
2024-02-14 09:47:10.494 [info] 
========================= 9 tests collected in 0.03s ==========================

User Settings


languageServer: "Pylance"

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

Extension version: 2024.0.1
VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:49:37.021Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz (6 x 2808)
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 31.88GB (24.00GB free)
Process Argv --crash-reporter-id 740c1c88-a4df-4a6b-a3f7-54a42b844cec
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
pydisww1:30959800
3ef8e399:30962115
e3gdj431:30958358

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 14, 2024
@eleanorjboyd
Copy link
Member

Hi! This is a duplicate of the following issue: #22870, which I am planning to fix. Please follow that issue for updates. Thanks!

@eleanorjboyd eleanorjboyd closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2024
@eleanorjboyd eleanorjboyd added area-testing and removed triage-needed Needs assignment to the proper sub-team labels Feb 14, 2024
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Feb 14, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants