fix conftest related fixture visibility issue: when running with a
CWD outside a test package pytest would get fixture discovery wrong. Thanks to Wolfgang Schnerring for figuring out a reproducable example. --HG-- branch : conftest-nodeid
This commit is contained in:
@@ -1611,10 +1611,15 @@ class FixtureManager:
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
# construct the base nodeid which is later used to check
|
||||
# what fixtures are visible for particular tests (as denoted
|
||||
# by their test id)
|
||||
if p.basename.startswith("conftest.py"):
|
||||
nodeid = p.dirpath().relto(self.session.fspath)
|
||||
nodeid = self.session.fspath.bestrelpath(p.dirpath())
|
||||
if p.sep != "/":
|
||||
nodeid = nodeid.replace(p.sep, "/")
|
||||
if nodeid == ".":
|
||||
nodeid = ""
|
||||
self.parsefactories(plugin, nodeid)
|
||||
self._seenplugins.add(plugin)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user