diff --git a/changelog/8447.deprecation.rst b/changelog/8447.deprecation.rst index d2c9cea1720..d1011f8c849 100644 --- a/changelog/8447.deprecation.rst +++ b/changelog/8447.deprecation.rst @@ -1,4 +1,4 @@ Defining a custom pytest node type which is both an item and a collector now issues a warning. It was never sanely supported and triggers hard to debug errors. -Instead, a separate collector node should be used, which collects the item. See :ref:`nonpython` for an example. +Instead, a separate collector node should be used, which collects the item. See :ref:`non-python tests` for an example. diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index 1d2f81b30af..4d12f07a27a 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -653,7 +653,8 @@ def __init_subclass__(cls) -> None: f"{cls.__name__} is an Item subclass and should not be a collector, " f"however its bases {problems} are collectors.\n" "Please split the Collectors and the Item into separate node types.\n" - "TODO: doc link", + "Pytest Doc example: https://docs.pytest.org/en/latest/example/nonpython.html\n" + "example pull request on a plugin: https://github.com/asmeurer/pytest-flakes/pull/40/", PytestWarning, ) diff --git a/testing/test_nodes.py b/testing/test_nodes.py index 35dea1dfa92..e1478c061e4 100644 --- a/testing/test_nodes.py +++ b/testing/test_nodes.py @@ -46,7 +46,7 @@ def test_subclassing_both_item_and_collector_warns(request, tmp_path: Path) -> N PytestWarning, match=( "(?m)SoWrong is an Item subclass and should not be a collector, however its bases File are collectors.\n" - "Please split the Collectors and the Item into separate node types.\nTODO:.*" + "Please split the Collectors and the Item into separate node types.\n.*" ), ):