Skip to content

VS Code Python Extension Compatibility #184

Open
@eleanorjboyd

Description

@eleanorjboyd

Hello! I am a maintainer for the python for VS Code extension. I was investigating getting pytest-subtest to work correctly in the extension as outline in this issue and had some questions which I was looking for some help on.

here's the example Im working with

def test(subtests):
    with subtests.test(msg="First subtest"):
        assert 1 == 1
    with subtests.test(msg="Second subtest"):
        assert 2 == 1

output / outcome on running from the terminal:

test_subtest.py::test [First subtest] SUBPASS                                                                                                [100%]
test_subtest.py::test [Second subtest] SUBFAIL                                                                                               [100%]
test_subtest.py::test PASSED                                                                                                                 [100%]
  1. Do subtests get their own callable test ids? Currently I allow the "run" functionality in the sidebar of VS Code seen in this screenshot by calling a test by its specific id but wasn't able to find if a subtest has a specific one that was unique from its parent
Image
  1. Why does the parent test test_subtest.py::test pass if one of the subtests fails?

  2. Finally just curious what your thoughts are on ideal behavior. In my mind it would mirror subtests in unittest as it works now in vscode which is the parent node test_subtest.py::test is displayed in the tree on test discovery, and the children nodes are added to the tree after run (since this is when they are "known").

after discovery:
Image

after run:
Image

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions