[py-svn] commit/pytest: hpk42: getting rid of redundant "active" attribute
Bitbucket
commits-noreply at bitbucket.org
Mon Nov 19 12:42:19 CET 2012
1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/changeset/eec537f128e1/
changeset: eec537f128e1
user: hpk42
date: 2012-11-19 12:42:10
summary: getting rid of redundant "active" attribute
affected #: 1 file
diff -r e7a5763577a2b443125cbc9da8ef30a9f7bcb97a -r eec537f128e1a1e9c80e373051486c290fc24e46 _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -1197,8 +1197,10 @@
self._fixturestack.pop()
def _getfuncargvalue(self, fixturedef):
- if fixturedef.active:
- return fixturedef.cached_result
+ try:
+ return fixturedef.cached_result # set by fixturedef.execute()
+ except AttributeError:
+ pass
# prepare request fixturename and param attributes before
# calling into fixture function
@@ -1619,7 +1621,6 @@
startindex = unittest and 1 or None
self.argnames = getfuncargnames(func, startindex=startindex)
self.unittest = unittest
- self.active = False
self._finalizer = []
def addfinalizer(self, finalizer):
@@ -1631,9 +1632,11 @@
func()
# check neccesity of next commented call
self._fixturemanager.removefinalizer(self.finish)
- self.active = False
#print "finished", self
- #del self.cached_result
+ try:
+ del self.cached_result
+ except AttributeError:
+ pass
def execute(self, request):
kwargs = {}
@@ -1655,7 +1658,7 @@
except AttributeError:
pass
result = fixturefunc(**kwargs)
- self.active = True
+ assert not hasattr(self, "cached_result")
self.cached_result = result
return result
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list