-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
plugin: warningsrelated to the warnings builtin pluginrelated to the warnings builtin plugintopic: collectionrelated to the collection phaserelated to the collection phasetype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature
Description
What's the problem this feature will solve?
when i enable the new strict mode in pytest settings, i expect any warnings to become errors. but there seems to still be some warnings where this isn't the case:
# pyproject.toml
[tool.pytest]
strict = true# tests/test_foo.py
class TestFoo:
def __new__(cls): ...$ pytest --collectonly
===================================================================================== test session starts ======================================================================================
platform linux -- Python 3.14.0, pytest-8.4.2, pluggy-1.6.0
rootdir: /home/me/projects/test
configfile: pyproject.toml
collected 0 items
======================================================================================= warnings summary =======================================================================================
tests/test_foo.py:3
/home/me/projects/test/tests/test_foo.py:3: PytestCollectionWarning: cannot collect test class 'TestFoo' because it has a __new__ constructor (from: tests/test_foo.py)
class TestFoo:
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================= no tests collected in 0.01s ==================================================================================
Describe the solution you'd like
strict mode should make all pytest warnings an error by default
Alternative Solutions
configuring them as described here, but it would be much more convenient if i could enable all of pytest's strictness with a single setting.
Metadata
Metadata
Assignees
Labels
plugin: warningsrelated to the warnings builtin pluginrelated to the warnings builtin plugintopic: collectionrelated to the collection phaserelated to the collection phasetype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature