Skip to content

Commit

Permalink
Merge pull request #2910 from RonnyPfannschmidt/scopenode-sanitize-sp…
Browse files Browse the repository at this point in the history
…ecials

switch a special case in scope node lookup to a general one
  • Loading branch information
nicoddemus authored Nov 10, 2017
2 parents c33074c + 0108f26 commit 99496d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _pytest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@

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)

Expand Down Expand Up @@ -62,8 +64,6 @@ def provide(self):
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)

Expand Down
1 change: 1 addition & 0 deletions changelog/2910.trivial
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Internal refactoring to simplify scope node lookup.

0 comments on commit 99496d9

Please sign in to comment.