remove "mixed" capturing mode which is not used by pytest
--HG-- branch : capsimple1
This commit is contained in:
parent
18e12cbd67
commit
6f385fb4ea
|
@ -437,12 +437,10 @@ class StdCaptureFD(Capture):
|
||||||
reads from sys.stdin). If any of the 0,1,2 file descriptors
|
reads from sys.stdin). If any of the 0,1,2 file descriptors
|
||||||
is invalid it will not be captured.
|
is invalid it will not be captured.
|
||||||
"""
|
"""
|
||||||
def __init__(self, out=True, err=True, mixed=False,
|
def __init__(self, out=True, err=True, in_=True, patchsys=True):
|
||||||
in_=True, patchsys=True):
|
|
||||||
self._options = {
|
self._options = {
|
||||||
"out": out,
|
"out": out,
|
||||||
"err": err,
|
"err": err,
|
||||||
"mixed": mixed,
|
|
||||||
"in_": in_,
|
"in_": in_,
|
||||||
"patchsys": patchsys,
|
"patchsys": patchsys,
|
||||||
}
|
}
|
||||||
|
@ -452,7 +450,6 @@ class StdCaptureFD(Capture):
|
||||||
in_ = self._options['in_']
|
in_ = self._options['in_']
|
||||||
out = self._options['out']
|
out = self._options['out']
|
||||||
err = self._options['err']
|
err = self._options['err']
|
||||||
mixed = self._options['mixed']
|
|
||||||
patchsys = self._options['patchsys']
|
patchsys = self._options['patchsys']
|
||||||
if in_:
|
if in_:
|
||||||
try:
|
try:
|
||||||
|
@ -473,9 +470,7 @@ class StdCaptureFD(Capture):
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
if err:
|
if err:
|
||||||
if out and mixed:
|
if hasattr(err, 'write'):
|
||||||
tmpfile = self.out.tmpfile
|
|
||||||
elif hasattr(err, 'write'):
|
|
||||||
tmpfile = err
|
tmpfile = err
|
||||||
else:
|
else:
|
||||||
tmpfile = None
|
tmpfile = None
|
||||||
|
@ -540,7 +535,7 @@ class StdCapture(Capture):
|
||||||
modifies sys.stdout|stderr|stdin attributes and does not
|
modifies sys.stdout|stderr|stdin attributes and does not
|
||||||
touch underlying File Descriptors (use StdCaptureFD for that).
|
touch underlying File Descriptors (use StdCaptureFD for that).
|
||||||
"""
|
"""
|
||||||
def __init__(self, out=True, err=True, in_=True, mixed=False):
|
def __init__(self, out=True, err=True, in_=True):
|
||||||
self._oldout = sys.stdout
|
self._oldout = sys.stdout
|
||||||
self._olderr = sys.stderr
|
self._olderr = sys.stderr
|
||||||
self._oldin = sys.stdin
|
self._oldin = sys.stdin
|
||||||
|
@ -548,9 +543,7 @@ class StdCapture(Capture):
|
||||||
out = TextIO()
|
out = TextIO()
|
||||||
self.out = out
|
self.out = out
|
||||||
if err:
|
if err:
|
||||||
if mixed:
|
if not hasattr(err, 'write'):
|
||||||
err = out
|
|
||||||
elif not hasattr(err, 'write'):
|
|
||||||
err = TextIO()
|
err = TextIO()
|
||||||
self.err = err
|
self.err = err
|
||||||
self.in_ = in_
|
self.in_ = in_
|
||||||
|
|
|
@ -780,15 +780,6 @@ class TestStdCapture:
|
||||||
out, err = cap.readouterr()
|
out, err = cap.readouterr()
|
||||||
assert out == py.builtin._totext('\ufffd\n', 'unicode-escape')
|
assert out == py.builtin._totext('\ufffd\n', 'unicode-escape')
|
||||||
|
|
||||||
def test_capturing_mixed(self):
|
|
||||||
cap = self.getcapture(mixed=True)
|
|
||||||
sys.stdout.write("hello ")
|
|
||||||
sys.stderr.write("world")
|
|
||||||
sys.stdout.write(".")
|
|
||||||
out, err = cap.reset()
|
|
||||||
assert out.strip() == "hello world."
|
|
||||||
assert not err
|
|
||||||
|
|
||||||
def test_reset_twice_error(self):
|
def test_reset_twice_error(self):
|
||||||
cap = self.getcapture()
|
cap = self.getcapture()
|
||||||
print ("hello")
|
print ("hello")
|
||||||
|
|
Loading…
Reference in New Issue