Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

})
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.