simplify activate_funcargs

This commit is contained in:
holger krekel 2012-06-03 21:06:43 +02:00
parent 3f17784386
commit 4d77653bb0
1 changed files with 6 additions and 10 deletions

View File

@ -119,16 +119,12 @@ class CaptureManager:
return "", ""
def activate_funcargs(self, pyfuncitem):
if not hasattr(pyfuncitem, 'funcargs'):
return
assert not hasattr(self, '_capturing_funcarg')
capargs = []
if hasattr(pyfuncitem, 'funcargs'):
for name, capfuncarg in pyfuncitem.funcargs.items():
if name in ('capsys', 'capfd'):
capargs.append(capfuncarg)
if capargs:
self._capturing_funcarg = capargs[0]
self._capturing_funcarg._start()
assert not hasattr(self, '_capturing_funcarg')
self._capturing_funcarg = capfuncarg
capfuncarg._start()
def deactivate_funcargs(self):
capturing_funcarg = getattr(self, '_capturing_funcarg', None)