Make pytester use pytest's capture implementation

This commit is contained in:
Anthony Sottile 2017-02-19 10:24:41 -08:00
parent 6ba3475448
commit 8b598f00e9
1 changed files with 5 additions and 2 deletions

View File

@ -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)