Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Workaround for #3742 #3751
This patch fixes the test and breaks another test:
diff --git a/src/_pytest/main.py b/src/_pytest/main.py index 9599fa16..1aee4bfd 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -482,6 +482,7 @@ class Session(nodes.FSCollector): self.trace.root.indent -= 1 def _collect(self, arg): + from _pytest.python import Package names = self._parsearg(arg) argpath = names.pop(0) paths =  @@ -503,7 +504,7 @@ class Session(nodes.FSCollector): root = self._node_cache[pkginit] else: col = root._collectfile(pkginit) - if col: + if col and isinstance(col, Package): root = col self._node_cache[root.fspath] = root
With the above patch, all tests pass except for this one:
But this test has been changed in c02e8d8 as part of the package-scope fixtures support.
For the record the patch above feels like a hack, but I don't have time today to investigate this further. I would appreciate further suggestions here, and if someone finds a proper solution feel free to push to this branch.
I would like to get
@jonozzz i beleive the deeper issue comes from packags being collected on the same level as their modules and then dancing a dance around the collectors - a package should be collected from the fspath of a folder
its not yet clear how to reintegrate that propperly
@nicoddemus seems that it doesn't work for pytest-asyncio.