Skip to content

Commit

Permalink
Use new suspend/resume in global_and_fixture_disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Mar 19, 2019
1 parent 9af488b commit f8a6b22
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/_pytest/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def suspend_global_capture(self, in_=False):
cap.suspend_capturing(in_=in_)

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

Expand Down Expand Up @@ -180,14 +181,11 @@ def resume_fixture(self, item):
@contextlib.contextmanager
def global_and_fixture_disabled(self):
"""Context manager to temporarily disables global and current fixture capturing."""
# Need to undo local capsys-et-al if 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):
Expand Down

0 comments on commit f8a6b22

Please sign in to comment.