From ac7ebfa22e4e1d541557c499474eccc7c4d6b655 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 8 Mar 2020 12:38:21 +0100 Subject: [PATCH] doc: internal: fix `MultiCapture.readouterr` (#6878) Remove wrong docstring: it might actually return bytes. Replace it with a type annotation which is clear enough. --- src/_pytest/capture.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index a1335d654..5f29c5ca2 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -510,12 +510,16 @@ class MultiCapture: if self.in_: self.in_.done() - def readouterr(self): - """ return snapshot unicode value of stdout/stderr capturings. """ - return CaptureResult( - self.out.snap() if self.out is not None else "", - self.err.snap() if self.err is not None else "", - ) + def readouterr(self) -> CaptureResult: + if self.out: + out = self.out.snap() + else: + out = "" + if self.err: + err = self.err.snap() + else: + err = "" + return CaptureResult(out, err) class NoCapture: