diff --git a/_pytest/pytester.py b/_pytest/pytester.py index 723f8bbb4..17cba5700 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -14,6 +14,7 @@ from weakref import WeakKeyDictionary from py.builtin import print_ +from _pytest.capture import MultiCapture, SysCapture from _pytest._code import Source import py import pytest @@ -737,7 +738,8 @@ class Testdir(object): if kwargs.get("syspathinsert"): self.syspathinsert() now = time.time() - capture = py.io.StdCapture() + capture = MultiCapture(Capture=SysCapture) + capture.start_capturing() try: try: reprec = self.inline_run(*args, **kwargs) @@ -752,7 +754,8 @@ class Testdir(object): class reprec(object): ret = 3 finally: - out, err = capture.reset() + out, err = capture.readouterr() + capture.stop_capturing() sys.stdout.write(out) sys.stderr.write(err)