Make pytester use pytest's capture implementation
This commit is contained in:
parent
6ba3475448
commit
8b598f00e9
|
@ -14,6 +14,7 @@ from weakref import WeakKeyDictionary
|
||||||
|
|
||||||
from py.builtin import print_
|
from py.builtin import print_
|
||||||
|
|
||||||
|
from _pytest.capture import MultiCapture, SysCapture
|
||||||
from _pytest._code import Source
|
from _pytest._code import Source
|
||||||
import py
|
import py
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -737,7 +738,8 @@ class Testdir(object):
|
||||||
if kwargs.get("syspathinsert"):
|
if kwargs.get("syspathinsert"):
|
||||||
self.syspathinsert()
|
self.syspathinsert()
|
||||||
now = time.time()
|
now = time.time()
|
||||||
capture = py.io.StdCapture()
|
capture = MultiCapture(Capture=SysCapture)
|
||||||
|
capture.start_capturing()
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
reprec = self.inline_run(*args, **kwargs)
|
reprec = self.inline_run(*args, **kwargs)
|
||||||
|
@ -752,7 +754,8 @@ class Testdir(object):
|
||||||
class reprec(object):
|
class reprec(object):
|
||||||
ret = 3
|
ret = 3
|
||||||
finally:
|
finally:
|
||||||
out, err = capture.reset()
|
out, err = capture.readouterr()
|
||||||
|
capture.stop_capturing()
|
||||||
sys.stdout.write(out)
|
sys.stdout.write(out)
|
||||||
sys.stderr.write(err)
|
sys.stderr.write(err)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue