CaptureFixture: do not crash in _suspend when not started
This happened in test_pdb_with_caplog_on_pdb_invocation.
This commit is contained in:
parent
a0ff5deabf
commit
e0b584d048
|
@ -358,8 +358,7 @@ class CaptureFixture(object):
|
||||||
self._captured_err = self.captureclass.EMPTY_BUFFER
|
self._captured_err = self.captureclass.EMPTY_BUFFER
|
||||||
|
|
||||||
def _start(self):
|
def _start(self):
|
||||||
# Start if not started yet
|
if self._capture is None:
|
||||||
if getattr(self, "_capture", None) is None:
|
|
||||||
self._capture = MultiCapture(
|
self._capture = MultiCapture(
|
||||||
out=True, err=True, in_=False, Capture=self.captureclass
|
out=True, err=True, in_=False, Capture=self.captureclass
|
||||||
)
|
)
|
||||||
|
@ -389,10 +388,12 @@ class CaptureFixture(object):
|
||||||
|
|
||||||
def _suspend(self):
|
def _suspend(self):
|
||||||
"""Suspends this fixture's own capturing temporarily."""
|
"""Suspends this fixture's own capturing temporarily."""
|
||||||
|
if self._capture is not None:
|
||||||
self._capture.suspend_capturing()
|
self._capture.suspend_capturing()
|
||||||
|
|
||||||
def _resume(self):
|
def _resume(self):
|
||||||
"""Resumes this fixture's own capturing temporarily."""
|
"""Resumes this fixture's own capturing temporarily."""
|
||||||
|
if self._capture is not None:
|
||||||
self._capture.resume_capturing()
|
self._capture.resume_capturing()
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
|
|
Loading…
Reference in New Issue