From 9f6cd8e916882741cc7ea3e02f3fdcc67f6ffd49 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 8 Nov 2021 09:17:46 +0200 Subject: [PATCH 1/2] nodes: keep plugins which subclass Item, File working for a bit more Fix #8435. --- src/_pytest/nodes.py | 8 ++++++-- testing/test_nodes.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index 09bbda0a24b..7acc37a1c74 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -669,9 +669,13 @@ def __init__( nodeid: Optional[str] = None, **kw, ) -> None: + # The first two arguments are intentionally passed postionally, + # 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 57a942c25db..c8afe0252be 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) From 7bba88ced77b7ab9597deeff0c63ed31b18dde7f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 8 Nov 2021 15:32:35 +0100 Subject: [PATCH 2/2] Update src/_pytest/nodes.py Co-authored-by: Bruno Oliveira --- src/_pytest/nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index 7acc37a1c74..d4505b6d6c3 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -669,7 +669,7 @@ def __init__( nodeid: Optional[str] = None, **kw, ) -> None: - # The first two arguments are intentionally passed postionally, + # 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.