switch a special case in scope node lookup to a general one

This commit is contained in:
Ronny Pfannschmidt 2017-10-20 12:43:17 +02:00
parent c33074c8b9
commit c47dcaa713
2 changed files with 3 additions and 2 deletions

View File

@ -27,10 +27,12 @@ from collections import OrderedDict
def pytest_sessionstart(session):
import _pytest.python
scopename2class.update({
'class': _pytest.python.Class,
'module': _pytest.python.Module,
'function': _pytest.main.Item,
'session': _pytest.main.Session,
})
session._fixturemanager = FixtureManager(session)
@ -62,8 +64,6 @@ def scopeproperty(name=None, doc=None):
def get_scope_node(node, scope):
cls = scopename2class.get(scope)
if cls is None:
if scope == "session":
return node.session
raise ValueError("unknown scope")
return node.getparent(cls)

1
changelog/2910.trivial Normal file
View File

@ -0,0 +1 @@
interal refactoring to simplify scope node lookup