Skip to content

Commit 817c094

Browse files
committed
Clean up Package.__init__
Makes `parent` a required arg, which would have failed before via `parent.session` anyway. Keeps calling/passing unused args for B/C.
1 parent 9b8039c commit 817c094

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/_pytest/python.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,15 +545,23 @@ def _importtestmodule(self):
545545

546546

547547
class Package(Module):
548-
def __init__(self, fspath, parent=None, config=None, session=None, nodeid=None):
548+
def __init__(
549+
self,
550+
fspath: py.path.local,
551+
parent: nodes.Collector,
552+
# NOTE: following args are unused:
553+
config=None,
554+
session=None,
555+
nodeid=None,
556+
) -> None:
557+
# NOTE: could be just the following, but kept as-is for compat.
558+
# nodes.FSCollector.__init__(self, fspath, parent=parent)
549559
session = parent.session
550560
nodes.FSCollector.__init__(
551561
self, fspath, parent=parent, config=config, session=session, nodeid=nodeid
552562
)
563+
553564
self.name = fspath.dirname
554-
self.trace = session.trace
555-
self._norecursepatterns = session._norecursepatterns
556-
self.fspath = fspath
557565

558566
def setup(self):
559567
# not using fixtures to call setup_module here because autouse fixtures

0 commit comments

Comments
 (0)