summaryrefslogtreecommitdiff
path: root/_pytest/main.py
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2013-12-07 16:37:46 +0100
committerholger krekel <holger@merlinux.eu>2013-12-07 16:37:46 +0100
commit4f0879ff9b3e7ad0da1839131c35b4e6412b972f (patch)
treec9d72163fc3f8bda9565f6dd78649bd9599d8f19 /_pytest/main.py
parent4b9dbd3920e1aff1e70b221406393f4eabd76056 (diff)
downloadpytest-4f0879ff9b3e7ad0da1839131c35b4e6412b972f.tar.gz
refactor internal finalization mechanics such that all fixture arguments
in a test invocation will have a corresponding FixtureDef instance. also fixes issue246 (again). simplify parametrized fixture teardown by making it work lazy: during the setup of a parametrized fixture instance any previously setup instance which was setup with a different param is torn down before setting up the new one.
Diffstat (limited to '_pytest/main.py')
-rw-r--r--_pytest/main.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/_pytest/main.py b/_pytest/main.py
index 48084bab9..75cb487e4 100644
--- a/_pytest/main.py
+++ b/_pytest/main.py
@@ -230,6 +230,8 @@ class Node(object):
#: allow adding of extra keywords to use for matching
self.extra_keyword_matches = set()
+ # used for storing artificial fixturedefs for direct parametrization
+ self._name2pseudofixturedef = {}
#self.extrainit()
@property
@@ -365,6 +367,8 @@ class Node(object):
self.session._setupstate.addfinalizer(fin, self)
def getparent(self, cls):
+ """ get the next parent node (including ourself)
+ which is an instance of the given class"""
current = self
while current and not isinstance(current, cls):
current = current.parent