diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index 09bbda0a2..d4505b6d6 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -669,9 +669,13 @@ class Item(Node): nodeid: Optional[str] = None, **kw, ) -> None: + # The first two arguments are intentionally passed positionally, + # to keep plugins who define a node type which inherits from + # (pytest.Item, pytest.File) working (see issue #8435). + # They can be made kwargs when the deprecation above is done. super().__init__( - name=name, - parent=parent, + name, + parent, config=config, session=session, nodeid=nodeid, diff --git a/testing/test_nodes.py b/testing/test_nodes.py index 57a942c25..c8afe0252 100644 --- a/testing/test_nodes.py +++ b/testing/test_nodes.py @@ -71,7 +71,7 @@ def test_subclassing_both_item_and_collector_deprecated( ), ): - class SoWrong(nodes.File, nodes.Item): + class SoWrong(nodes.Item, nodes.File): def __init__(self, fspath, parent): """Legacy ctor with legacy call # don't wana see""" super().__init__(fspath, parent)