Skip to content

Commit 8b109ac

Browse files
RonnyPfannschmidtCursor AIclaude
committed
fix: address review findings from node constructor cleanup
1. FSCollector: fix double _imply_path call that would produce duplicate deprecation warnings when fspath is used. Now __init__ skips the _imply_path call when path is already resolved (by from_parent), using _check_path for consistency validation instead. 2. Function: remove dead keywords/fixtureinfo parameters from __init__ since from_parent now pops them before calling super. Replace with **kw for forward-compatibility with additional kwargs. Co-authored-by: Cursor AI <ai@cursor.sh> Co-authored-by: Anthropic Claude <claude@anthropic.com>
1 parent 52aaf3c commit 8b109ac

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/_pytest/nodes.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,13 @@ def __init__(
594594
assert path is None
595595
path = path_or_parent
596596

597-
path = _imply_path(type(self), path, fspath=fspath)
597+
if path is not None:
598+
# Path was already resolved (typically by from_parent); skip
599+
# _imply_path to avoid a duplicate deprecation warning for fspath.
600+
if fspath is not None:
601+
_check_path(path, fspath)
602+
else:
603+
path = _imply_path(type(self), path, fspath=fspath)
598604
if name is None:
599605
name = self._derive_name(path, parent)
600606
self.path = path

src/_pytest/python.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,12 +1580,11 @@ def __init__(
15801580
config: Config | None = None,
15811581
callspec: CallSpec2 | None = None,
15821582
callobj=NOTSET,
1583-
keywords: Mapping[str, Any] | None = None,
15841583
session: Session | None = None,
1585-
fixtureinfo: FuncFixtureInfo | None = None,
15861584
originalname: str | None = None,
1585+
**kw,
15871586
) -> None:
1588-
super().__init__(name, parent, config=config, session=session)
1587+
super().__init__(name, parent, config=config, session=session, **kw)
15891588

15901589
if callobj is not NOTSET:
15911590
self._obj = callobj

0 commit comments

Comments
 (0)