From 951213ee0937c3fef7ce29052fcc2004866e0ffa Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 19 Mar 2019 01:27:59 +0100 Subject: [PATCH] Use new suspend/resume in global_and_fixture_disabled --- src/_pytest/capture.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index 3f6055bd8..0e8a693e8 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -145,6 +145,7 @@ class CaptureManager(object): cap.suspend_capturing(in_=in_) def suspend(self, in_=False): + # Need to undo local capsys-et-al if it exists before disabling global capture. self.suspend_fixture(self._current_item) self.suspend_global_capture(in_) @@ -186,14 +187,11 @@ class CaptureManager(object): @contextlib.contextmanager def global_and_fixture_disabled(self): """Context manager to temporarily disable global and current fixture capturing.""" - # Need to undo local capsys-et-al if it exists before disabling global capture. - self.suspend_fixture(self._current_item) - self.suspend_global_capture(in_=False) + self.suspend() try: yield finally: - self.resume_global_capture() - self.resume_fixture(self._current_item) + self.resume() @contextlib.contextmanager def item_capture(self, when, item):