Describe the bug
Running the test suite produces the following warnings:
test/util/test_progress.py:15
/home/appveyor/projects/xcube/test/util/test_progress.py:15: PytestCollectionWarning: cannot collect test class 'TestProgressObserver' because it has a __init__ constructor (from: test/core/gen2/remote/test_generator.py)
class TestProgressObserver(ProgressObserver):
test/core/gridmapping/test_base.py:19
/home/appveyor/projects/xcube/test/core/gridmapping/test_base.py:19: PytestCollectionWarning: cannot collect test class 'TestGridMapping' because it has a __init__ constructor (from: test/core/gridmapping/test_base.py)
class TestGridMapping(GridMapping):
test/util/test_extension.py:132
/home/appveyor/projects/xcube/test/util/test_extension.py:132: PytestCollectionWarning: cannot collect test class 'TestComponent' because it has a __init__ constructor (from: test/util/test_extension.py)
This is misleading: the classes in question are helper classes for testing, not containers for actual tests, so there is nothing for pytest to collect and the __init__ methods are fine. However, pytest has no way of knowing this.
To Reproduce
Steps to reproduce the behavior:
Run test suite (commit 98f6a37aa26).
Observe warnings.
Expected behavior
The warnings described above should not appear.
Suggested solution
If the class names did not start with Test, pytest would not attempt to scan them for tests. Prefixing the class names with an underscore would suffice.
Describe the bug Running the test suite produces the following warnings:
This is misleading: the classes in question are helper classes for testing, not containers for actual tests, so there is nothing for pytest to collect and the
__init__
methods are fine. However, pytest has no way of knowing this.To Reproduce Steps to reproduce the behavior:
Expected behavior The warnings described above should not appear.
Suggested solution If the class names did not start with
Test
, pytest would not attempt to scan them for tests. Prefixing the class names with an underscore would suffice.