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.
This commit is contained in:
Daniel Hahler 2020-01-14 17:57:24 +01:00
parent 9b8039cf09
commit 817c094ce6
1 changed files with 12 additions and 4 deletions

View File

@ -545,15 +545,23 @@ class Module(nodes.File, PyCollector):
class Package(Module):
def __init__(self, fspath, parent=None, config=None, session=None, nodeid=None):
def __init__(
self,
fspath: py.path.local,
parent: nodes.Collector,
# NOTE: following args are unused:
config=None,
session=None,
nodeid=None,
) -> None:
# NOTE: could be just the following, but kept as-is for compat.
# nodes.FSCollector.__init__(self, fspath, parent=parent)
session = parent.session
nodes.FSCollector.__init__(
self, fspath, parent=parent, config=config, session=session, nodeid=nodeid
)
self.name = fspath.dirname
self.trace = session.trace
self._norecursepatterns = session._norecursepatterns
self.fspath = fspath
def setup(self):
# not using fixtures to call setup_module here because autouse fixtures