Skip to content

Conversation

@adamchainz
Copy link
Member

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 to flag the class as non-test.

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.
Copy link
Member

@kingbuzzman kingbuzzman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kingbuzzman kingbuzzman merged commit 247ec1c into pytest-dev:main Jan 2, 2026
25 checks passed
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.

2 participants