Skip to content

Commit 247ec1c

Browse files
authored
Fix PytestCollectionWarning for TestRunner class (#1259)
Fix this warning seen in the pytest output: ``` pytest_django/runner.py:6 /.../pytest-django/pytest_django/runner.py:6: PytestCollectionWarning: cannot collect test class 'TestRunner' because it has a __init__ constructor (from: tests/test_runner.py) class TestRunner: ``` The fix uses [`__test__ = False`](https://docs.pytest.org/en/stable/example/pythoncollection.html#:~:text=boolean%20%5F%5Ftest%5F%5F%20attribute) to flag the class as non-test.
1 parent de19d76 commit 247ec1c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

pytest_django/runner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
class TestRunner:
77
"""A Django test runner which uses pytest to discover and run tests when using `manage.py test`."""
88

9+
__test__ = False
10+
911
def __init__(
1012
self,
1113
*,

0 commit comments

Comments
 (0)