[py-svn] commit/pytest: hpk42: simplify activate_funcargs

Bitbucket commits-noreply at bitbucket.org
Sun Jun 3 21:06:49 CEST 2012


1 new commit in pytest:


https://bitbucket.org/hpk42/pytest/changeset/5ae8dc3cc4bf/
changeset:   5ae8dc3cc4bf
user:        hpk42
date:        2012-06-03 21:06:43
summary:     simplify activate_funcargs
affected #:  1 file

diff -r 4f01dd1ab7969b6d3aba90f395d70f7250339712 -r 5ae8dc3cc4bfe64cf3ac2e43e30c7c96816737b6 _pytest/capture.py
--- a/_pytest/capture.py
+++ b/_pytest/capture.py
@@ -119,16 +119,12 @@
         return "", ""
 
     def activate_funcargs(self, pyfuncitem):
-        if not hasattr(pyfuncitem, 'funcargs'):
-            return
-        assert not hasattr(self, '_capturing_funcarg')
-        capargs = []
-        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()
+        if hasattr(pyfuncitem, 'funcargs'):
+            for name, capfuncarg in pyfuncitem.funcargs.items():
+                if name in ('capsys', 'capfd'):
+                    assert not hasattr(self, '_capturing_funcarg')
+                    self._capturing_funcarg = capfuncarg
+                    capfuncarg._start()
 
     def deactivate_funcargs(self):
         capturing_funcarg = getattr(self, '_capturing_funcarg', None)

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