Skip to content

Skip test display correctly in test explorer #21674

Closed

Description

given a file called skip_test_file_node.py that has raise SkipTest(".....") this should appear in the sidebar with no children. The bug is that currently it shows a "unittest" node that gives "loader" and other incorrect nodes below it.

image

This is wrong, thought I fixed it with, #21665, but it is still persisting.

Activity

  1. eleanorjboyd commented on Oct 23, 2023

    @eleanorjboyd
    MemberAuthor

    yes this is good now. Try with below:

    import unittest
    
    raise unittest.SkipTest("This is unittest.SkipTest calling")
    
    
    class TestExample(unittest.TestCase):
        def test_sample(self):
            self.assertEqual(1 + 1, 2)
    
    
    class TestExample2(unittest.TestCase):
        def test_sample2(self):
            self.assertEqual(1 + 1, 2)
    

    should see single node for the file in the test explorer and no more children under it

  2. joaomoreno commented on Oct 25, 2023

    @joaomoreno

    I'm sorry, it's really not clear to me what I'm doing wrong here:

    Screen.Recording.2023-10-25.at.11.31.06.mov

    Please provide repro steps.

  3. eleanorjboyd commented on Oct 25, 2023

    @eleanorjboyd
    MemberAuthor

    Hi! Everything looks right except the file name is not a valid single identifier in Python (I had to do some research because this initially confused me too). But the summary is that Python naming pretty much have to follow these rules so a . or - makes the name invalid. Specifically for . it view it as a module so if you did test_other.test.py it would work with the pattern of *test*.py. So just try again using the name what_test.py and it should work great!

    Start with a letter or an underscore (_): Identifiers cannot start with a digit.
    
    Followed by letters, numbers, or underscores: After the first letter or underscore, the identifier can contain any combination of letters (a-z, A-Z), digits (0-9), and underscores (_).
    
  4. locked as resolved and limited conversation to collaborators on Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions