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

Pytests tests embedded into __main__ are reported as not used #377

Open
ssbarnea opened this issue Nov 25, 2024 · 1 comment
Open

Pytests tests embedded into __main__ are reported as not used #377

ssbarnea opened this issue Nov 25, 2024 · 1 comment

Comments

@ssbarnea
Copy link

Vulture reports unittests embedded in source files via __main__ conditional as not being used, even if they are used.

if "pytest" in sys.modules:

    def test_foo() -> None:
        pass

Not sure how to deal with this because I have a considerable amount of tests that are defined like this, and this is fully supported by pytest, which does correctly recognize them.

@jendrikseipp
Copy link
Owner

Can you paste a more complete example of your pytest file setup and how you invoke the tests, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants