bottlepy / bottle

bottle.py is a fast and simple micro-framework for python web-applications.
http://bottlepy.org/
MIT License
8.33k stars 1.46k forks source link

rename TestError to ExampleError to avoid PytestCollectionWarning #1396

Open clavedeluna opened 1 year ago

clavedeluna commented 1 year ago

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 :)