Collapse all parent nested package fixtures when pointing to a sub-node.
Example: Given this hierarchy: p1.s1.s2.s3 I want to run pytest p1/s1/s2/s3/foo.py If there are any package fixtures defined at p1..s2 levels, they should also be executed.
This commit is contained in:
parent
69031d0033
commit
dc90c9108f
|
@ -75,10 +75,11 @@ def get_scope_package(node, fixturedef):
|
||||||
cls = node.Package
|
cls = node.Package
|
||||||
current = node
|
current = node
|
||||||
fixture_package_name = os.path.join(fixturedef.baseid, '__init__.py')
|
fixture_package_name = os.path.join(fixturedef.baseid, '__init__.py')
|
||||||
while current and type(current) is not cls or \
|
while current and (type(current) is not cls or \
|
||||||
fixture_package_name != current.nodeid:
|
fixture_package_name != current.nodeid):
|
||||||
current = current.parent
|
current = current.parent
|
||||||
assert current
|
if current is None:
|
||||||
|
return node.session
|
||||||
return current
|
return current
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue