diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index 3147d9728..8e9715cd8 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -64,7 +64,7 @@ def pytest_load_initial_conftests(early_config, parser, args): outcome = yield capman.suspend_global_capture() if outcome.excinfo is not None: - out, err = capman.snap_global_capture() + out, err = capman.read_global_capture() sys.stdout.write(out) sys.stderr.write(err) @@ -118,7 +118,7 @@ class CaptureManager(object): if cap is not None: cap.suspend_capturing(in_=in_) - def snap_global_capture(self): + def read_global_capture(self): return self._global_capturing.readouterr() # Fixture Control (its just forwarding, think about removing this later) @@ -171,7 +171,7 @@ class CaptureManager(object): self.deactivate_fixture(item) self.suspend_global_capture(in_=False) - out, err = self.snap_global_capture() + out, err = self.read_global_capture() item.add_report_section(when, "stdout", out) item.add_report_section(when, "stderr", err) @@ -183,7 +183,7 @@ class CaptureManager(object): self.resume_global_capture() outcome = yield self.suspend_global_capture() - out, err = self.snap_global_capture() + out, err = self.read_global_capture() rep = outcome.get_result() if out: rep.sections.append(("Captured stdout", out)) diff --git a/src/_pytest/debugging.py b/src/_pytest/debugging.py index a0594e3e8..f51dff373 100644 --- a/src/_pytest/debugging.py +++ b/src/_pytest/debugging.py @@ -103,7 +103,7 @@ class PdbInvoke(object): capman = node.config.pluginmanager.getplugin("capturemanager") if capman: capman.suspend_global_capture(in_=True) - out, err = capman.snap_global_capture() + out, err = capman.read_global_capture() sys.stdout.write(out) sys.stdout.write(err) _enter_pdb(node, call.excinfo, report) diff --git a/src/_pytest/setuponly.py b/src/_pytest/setuponly.py index 721b0a942..c3edc5f81 100644 --- a/src/_pytest/setuponly.py +++ b/src/_pytest/setuponly.py @@ -52,7 +52,7 @@ def _show_fixture_action(fixturedef, msg): capman = config.pluginmanager.getplugin("capturemanager") if capman: capman.suspend_global_capture() - out, err = capman.snap_global_capture() + out, err = capman.read_global_capture() tw = config.get_terminal_writer() tw.line() diff --git a/testing/test_capture.py b/testing/test_capture.py index c029a21f9..fb0e14b97 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -71,14 +71,14 @@ class TestCaptureManager(object): capman = CaptureManager(method) capman.start_global_capturing() capman.suspend_global_capture() - outerr = capman.snap_global_capture() + outerr = capman.read_global_capture() assert outerr == ("", "") capman.suspend_global_capture() - outerr = capman.snap_global_capture() + outerr = capman.read_global_capture() assert outerr == ("", "") print("hello") capman.suspend_global_capture() - out, err = capman.snap_global_capture() + out, err = capman.read_global_capture() if method == "no": assert old == (sys.stdout, sys.stderr, sys.stdin) else: @@ -86,7 +86,7 @@ class TestCaptureManager(object): capman.resume_global_capture() print("hello") capman.suspend_global_capture() - out, err = capman.snap_global_capture() + out, err = capman.read_global_capture() if method != "no": assert out == "hello\n" capman.stop_global_capturing()