Use new suspend/resume in global_and_fixture_disabled

This commit is contained in:
Daniel Hahler 2019-03-19 01:27:59 +01:00
parent ae067df941
commit 951213ee09
1 changed files with 3 additions and 5 deletions

View File

@ -145,6 +145,7 @@ class CaptureManager(object):
cap.suspend_capturing(in_=in_) cap.suspend_capturing(in_=in_)
def suspend(self, in_=False): 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_fixture(self._current_item)
self.suspend_global_capture(in_) self.suspend_global_capture(in_)
@ -186,14 +187,11 @@ class CaptureManager(object):
@contextlib.contextmanager @contextlib.contextmanager
def global_and_fixture_disabled(self): def global_and_fixture_disabled(self):
"""Context manager to temporarily disable global and current fixture capturing.""" """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()
self.suspend_fixture(self._current_item)
self.suspend_global_capture(in_=False)
try: try:
yield yield
finally: finally:
self.resume_global_capture() self.resume()
self.resume_fixture(self._current_item)
@contextlib.contextmanager @contextlib.contextmanager
def item_capture(self, when, item): def item_capture(self, when, item):