From 80911841430ffcd557fef666f4c681055d6f1f97 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sun, 19 Feb 2017 10:24:41 -0800 Subject: [PATCH] Make pytester use pytest's capture implementation --- _pytest/pytester.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/_pytest/pytester.py b/_pytest/pytester.py index de24f904442..017e6631137 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -12,6 +12,7 @@ from py.builtin import print_ +from _pytest.capture import MultiCapture, SysCapture from _pytest._code import Source import py import pytest @@ -734,7 +735,8 @@ def runpytest_inprocess(self, *args, **kwargs): 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) @@ -749,7 +751,8 @@ class reprec: class reprec: ret = 3 finally: - out, err = capture.reset() + out, err = capture.readouterr() + capture.stop_capturing() sys.stdout.write(out) sys.stderr.write(err)