Skip to content

Commit 951213e

Browse files
committed
Use new suspend/resume in global_and_fixture_disabled
1 parent ae067df commit 951213e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/_pytest/capture.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def suspend_global_capture(self, in_=False):
145145
cap.suspend_capturing(in_=in_)
146146

147147
def suspend(self, in_=False):
148+
# Need to undo local capsys-et-al if it exists before disabling global capture.
148149
self.suspend_fixture(self._current_item)
149150
self.suspend_global_capture(in_)
150151

@@ -186,14 +187,11 @@ def resume_fixture(self, item):
186187
@contextlib.contextmanager
187188
def global_and_fixture_disabled(self):
188189
"""Context manager to temporarily disable global and current fixture capturing."""
189-
# Need to undo local capsys-et-al if it exists before disabling global capture.
190-
self.suspend_fixture(self._current_item)
191-
self.suspend_global_capture(in_=False)
190+
self.suspend()
192191
try:
193192
yield
194193
finally:
195-
self.resume_global_capture()
196-
self.resume_fixture(self._current_item)
194+
self.resume()
197195

198196
@contextlib.contextmanager
199197
def item_capture(self, when, item):

0 commit comments

Comments
 (0)