From 6f385fb4ea1cd9aabc184c0fa0c8fb1761564e47 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sat, 25 Jan 2014 19:56:27 +0100 Subject: [PATCH] remove "mixed" capturing mode which is not used by pytest --HG-- branch : capsimple1 --- _pytest/capture.py | 15 ++++----------- testing/test_capture.py | 9 --------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/_pytest/capture.py b/_pytest/capture.py index 0ce3637e0..04fcbbd0d 100644 --- a/_pytest/capture.py +++ b/_pytest/capture.py @@ -437,12 +437,10 @@ class StdCaptureFD(Capture): reads from sys.stdin). If any of the 0,1,2 file descriptors is invalid it will not be captured. """ - def __init__(self, out=True, err=True, mixed=False, - in_=True, patchsys=True): + def __init__(self, out=True, err=True, in_=True, patchsys=True): self._options = { "out": out, "err": err, - "mixed": mixed, "in_": in_, "patchsys": patchsys, } @@ -452,7 +450,6 @@ class StdCaptureFD(Capture): in_ = self._options['in_'] out = self._options['out'] err = self._options['err'] - mixed = self._options['mixed'] patchsys = self._options['patchsys'] if in_: try: @@ -473,9 +470,7 @@ class StdCaptureFD(Capture): except OSError: pass if err: - if out and mixed: - tmpfile = self.out.tmpfile - elif hasattr(err, 'write'): + if hasattr(err, 'write'): tmpfile = err else: tmpfile = None @@ -540,7 +535,7 @@ class StdCapture(Capture): modifies sys.stdout|stderr|stdin attributes and does not 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._olderr = sys.stderr self._oldin = sys.stdin @@ -548,9 +543,7 @@ class StdCapture(Capture): out = TextIO() self.out = out if err: - if mixed: - err = out - elif not hasattr(err, 'write'): + if not hasattr(err, 'write'): err = TextIO() self.err = err self.in_ = in_ diff --git a/testing/test_capture.py b/testing/test_capture.py index 3b235cc0c..aee7696ee 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -780,15 +780,6 @@ class TestStdCapture: out, err = cap.readouterr() 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): cap = self.getcapture() print ("hello")