Skip to content

Commit

Permalink
update documentation references for node inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed Jun 13, 2021
1 parent 7db9fa0 commit 46269d9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 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.
3 changes: 2 additions & 1 deletion src/_pytest/nodes.py
Expand Up @@ -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,
)

Expand Down
2 changes: 1 addition & 1 deletion testing/test_nodes.py
Expand Up @@ -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.*"
),
):

Expand Down

0 comments on commit 46269d9

Please sign in to comment.