Merge pull request #2910 from RonnyPfannschmidt/scopenode-sanitize-specials
switch a special case in scope node lookup to a general one
This commit is contained in:
commit
99496d9e5b
|
@ -27,10 +27,12 @@ from collections import OrderedDict
|
||||||
|
|
||||||
def pytest_sessionstart(session):
|
def pytest_sessionstart(session):
|
||||||
import _pytest.python
|
import _pytest.python
|
||||||
|
|
||||||
scopename2class.update({
|
scopename2class.update({
|
||||||
'class': _pytest.python.Class,
|
'class': _pytest.python.Class,
|
||||||
'module': _pytest.python.Module,
|
'module': _pytest.python.Module,
|
||||||
'function': _pytest.main.Item,
|
'function': _pytest.main.Item,
|
||||||
|
'session': _pytest.main.Session,
|
||||||
})
|
})
|
||||||
session._fixturemanager = FixtureManager(session)
|
session._fixturemanager = FixtureManager(session)
|
||||||
|
|
||||||
|
@ -62,8 +64,6 @@ def scopeproperty(name=None, doc=None):
|
||||||
def get_scope_node(node, scope):
|
def get_scope_node(node, scope):
|
||||||
cls = scopename2class.get(scope)
|
cls = scopename2class.get(scope)
|
||||||
if cls is None:
|
if cls is None:
|
||||||
if scope == "session":
|
|
||||||
return node.session
|
|
||||||
raise ValueError("unknown scope")
|
raise ValueError("unknown scope")
|
||||||
return node.getparent(cls)
|
return node.getparent(cls)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Internal refactoring to simplify scope node lookup.
|
Loading…
Reference in New Issue