From c47dcaa7134527abf40bd469864c433dfba1814b Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Fri, 20 Oct 2017 12:43:17 +0200 Subject: [PATCH 1/2] switch a special case in scope node lookup to a general one --- _pytest/fixtures.py | 4 ++-- changelog/2910.trivial | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog/2910.trivial diff --git a/_pytest/fixtures.py b/_pytest/fixtures.py index c5da9f4cf..5dc1aebcc 100644 --- a/_pytest/fixtures.py +++ b/_pytest/fixtures.py @@ -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) diff --git a/changelog/2910.trivial b/changelog/2910.trivial new file mode 100644 index 000000000..8b8557974 --- /dev/null +++ b/changelog/2910.trivial @@ -0,0 +1 @@ +interal refactoring to simplify scope node lookup \ No newline at end of file From 0108f262b1ad37b609222605182f90a33c3fa067 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 10 Nov 2017 18:15:09 -0200 Subject: [PATCH 2/2] Fix typo in CHANGELOG --- changelog/2910.trivial | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/2910.trivial b/changelog/2910.trivial index 8b8557974..87bf00dfe 100644 --- a/changelog/2910.trivial +++ b/changelog/2910.trivial @@ -1 +1 @@ -interal refactoring to simplify scope node lookup \ No newline at end of file +Internal refactoring to simplify scope node lookup.