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

Skip test display correctly in test explorer #21674

Closed
eleanorjboyd opened this issue Jul 21, 2023 · 3 comments
Closed

Skip test display correctly in test explorer #21674

eleanorjboyd opened this issue Jul 21, 2023 · 3 comments
Assignees
Labels
area-testing bug Issue identified by VS Code Team member as probable bug verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@eleanorjboyd
Copy link
Member

eleanorjboyd commented Jul 21, 2023

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.

@eleanorjboyd eleanorjboyd added bug Issue identified by VS Code Team member as probable bug area-testing needs PR Ready to be worked on labels Jul 21, 2023
@eleanorjboyd eleanorjboyd added this to the July 2023 milestone Jul 21, 2023
@eleanorjboyd eleanorjboyd self-assigned this Jul 21, 2023
@eleanorjboyd eleanorjboyd modified the milestones: July 2023, August 2023 Jul 25, 2023
@eleanorjboyd eleanorjboyd added verification-needed Verification of issue is requested and removed verification-needed Verification of issue is requested labels Aug 28, 2023
@eleanorjboyd
Copy link
Member Author

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

@eleanorjboyd eleanorjboyd added verification-needed Verification of issue is requested and removed needs PR Ready to be worked on labels Oct 23, 2023
@joaomoreno joaomoreno added the verification-steps-needed Steps to verify are needed for verification label Oct 25, 2023
@joaomoreno
Copy link
Member

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.

@eleanorjboyd
Copy link
Member Author

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 (_).

@amunger amunger added verified Verification succeeded and removed verification-steps-needed Steps to verify are needed for verification labels Oct 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing bug Issue identified by VS Code Team member as probable bug verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants