nodes: keep plugins which subclass Item, File working for a bit more (#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 <nicoddemus@gmail.com> Co-authored-by: Florian Bruhin <me@the-compiler.org> Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
This commit is contained in:
parent
eb6c4493b2
commit
f87df9c52e
|
@ -669,9 +669,13 @@ class Item(Node):
|
||||||
nodeid: Optional[str] = None,
|
nodeid: Optional[str] = None,
|
||||||
**kw,
|
**kw,
|
||||||
) -> None:
|
) -> 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__(
|
super().__init__(
|
||||||
name=name,
|
name,
|
||||||
parent=parent,
|
parent,
|
||||||
config=config,
|
config=config,
|
||||||
session=session,
|
session=session,
|
||||||
nodeid=nodeid,
|
nodeid=nodeid,
|
||||||
|
|
|
@ -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):
|
def __init__(self, fspath, parent):
|
||||||
"""Legacy ctor with legacy call # don't wana see"""
|
"""Legacy ctor with legacy call # don't wana see"""
|
||||||
super().__init__(fspath, parent)
|
super().__init__(fspath, parent)
|
||||||
|
|
Loading…
Reference in New Issue