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

rename TestError to ExampleError to avoid PytestCollectionWarning #1396

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

clavedeluna
Copy link
Contributor

@clavedeluna clavedeluna commented Sep 5, 2022

When running tests, this warning is raised:

test/test_exc.py:4
  /Users/dani/bottle/test/test_exc.py:4: PytestCollectionWarning: cannot collect test class 'TestError' because it has a __init__ constructor (from: test/test_exc.py)
    class TestError(Exception):

this is because pytest is trying to collect all classes starting with the word Test. Since this class isn't an actual test, renaming it to something else is appropriate.
Another solution would've been to add __test__ = False to the class, but renaming seemed straight-forward.

It's always nice to run tests and not see warnings, so I may fix some more in upcoming PRs :)

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

Successfully merging this pull request may close these issues.

None yet

1 participant