Skip to content

Commit 95203cb

Browse files
test: ignore the warnings about becoming a fixture via config.
1 parent 1b9872a commit 95203cb

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

changelog/12989.improvement.rst

+8-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
Issues a warning when a function is not collected as a test case just because it uses :py:func:`@pytest.fixture`
1+
Issues a warning when a function is not collected as a test case just because it uses :py:func:`@pytest.fixture`.
2+
This helps beginners distinguish fixtures from tests; experienced users can ignore the warning via config.
3+
4+
.. code-block:: ini
5+
6+
[pytest]
7+
filterwarnings =
8+
ignore:.*becomes a fixture.*:pytest.PytestCollectionWarning

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ filterwarnings = [
403403
"ignore:VendorImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning",
404404
# https://github.com/pytest-dev/execnet/pull/127
405405
"ignore:isSet\\(\\) is deprecated, use is_set\\(\\) instead:DeprecationWarning",
406+
"ignore:.*becomes a fixture.*:pytest.PytestCollectionWarning",
406407
]
407408
pytester_example_dir = "testing/example_scripts"
408409
markers = [

0 commit comments

Comments
 (0)