Skip to content

Commit

Permalink
test: ignore the warnings about becoming a fixture via config.
Browse files Browse the repository at this point in the history
  • Loading branch information
dongfangtianyu committed Dec 11, 2024
1 parent 1b9872a commit 95203cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion changelog/12989.improvement.rst
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
Issues a warning when a function is not collected as a test case just because it uses :py:func:`@pytest.fixture`
Issues a warning when a function is not collected as a test case just because it uses :py:func:`@pytest.fixture`.
This helps beginners distinguish fixtures from tests; experienced users can ignore the warning via config.

.. code-block:: ini
[pytest]
filterwarnings =
ignore:.*becomes a fixture.*:pytest.PytestCollectionWarning
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ filterwarnings = [
"ignore:VendorImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning",
# https://github.com/pytest-dev/execnet/pull/127
"ignore:isSet\\(\\) is deprecated, use is_set\\(\\) instead:DeprecationWarning",
"ignore:.*becomes a fixture.*:pytest.PytestCollectionWarning",
]
pytester_example_dir = "testing/example_scripts"
markers = [
Expand Down

0 comments on commit 95203cb

Please sign in to comment.