Skip to content

Nested test classes not displaying pytest #22520

@JamesHutchison

Description

@JamesHutchison

Type: Bug

Create a pytest structure like this:

class TestMyClass
    def test_mytest

    class TestSubCategory
        def test_another_test

Extension version: 2023.20.0
VS Code version: Code 1.84.2 (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e, 2023-11-09T10:51:52.184Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 6.2.0-1016-azure

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 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) 15.89GB (6.27GB free)
Process Argv --crash-reporter-id ae591a24-d374-4309-8087-11db7f271645
Screen Reader no
VM 0%
Item Value
Remote Codespaces: orange giggle
OS Linux x64 6.2.0-1016-azure
CPUs AMD EPYC 7763 64-Core Processor (2 x 2432)
Memory (System) 7.74GB (5.29GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscorecescf:30445987
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263:30880072
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
2e4cg342:30602488
89544117:30613380
2i9eh265:30646982
showlangstatbar:30737416
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
synctok:30869157
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixtcf:30871695
pythonregdiag2:30871582
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:30885898
pythontbext0:30879054
accentitlementsc:30887149
dsvsc016:30886110
dsvsc017cf:30886113
dsvsc018:30886114
aa_t_chat:30882232

test_bug

You can easily reproduce this bug in a codespace for megamock

https://github.com/JamesHutchison/megamock

Logs indicate pytest is correctly finding the tests so it appears this is a bug in how the results are interpreted

2023-11-23 18:06:55.946 [info]       <Function test_allows_for_setting_different_type>
      <Function test_assert_called_once_with>
      <Function test_return_value_equality_set_in_params>
      <Function test_return_value_equality_set_via_attribute>
      <Function test_meganame>
      <Function test_nested_assignment>

2023-11-23 18:06:55.946 [info]       <Class TestGenerateMockName>
        <Function test_name_of_class>
        <Function test_name_of_method>
        <Function test_name_of_mock_with_no_spec>
        <Function test_child_of_mock_with_no_spec>

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable bugverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions