You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
Why does the parent test test_subtest.py::test pass if one of the subtests fails?
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:
after run:
Thanks!
The text was updated successfully, but these errors were encountered:
Awesome that you are working on this integration with VS Code!
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
They do not, and is not really possible to only execute a subtest individually - you need to execute the parent test, and all the subtests will run as result.
Why does the parent test test_subtest.py::test pass if one of the subtests fails?
That's kind of quirk on how the hooks work today -- while a subtest might fail, the "rest" of the parent test might still pass, consider:
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
output / outcome on running from the terminal:
Why does the parent test
test_subtest.py::test
pass if one of the subtests fails?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:
after run:
Thanks!
The text was updated successfully, but these errors were encountered: