Skip to content

Commit

Permalink
nodes: keep plugins which subclass Item, File working for a bit more (#…
Browse files Browse the repository at this point in the history
…9279)

* nodes: keep plugins which subclass Item, File working for a bit more

Fix #8435.

* Update src/_pytest/nodes.py

Co-authored-by: Bruno Oliveira <[email protected]>

Co-authored-by: Florian Bruhin <[email protected]>
Co-authored-by: Bruno Oliveira <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2021
1 parent eb6c449 commit f87df9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/_pytest/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,9 +669,13 @@ def __init__(
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,
Expand Down
2 changes: 1 addition & 1 deletion testing/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f87df9c

Please sign in to comment.