hbutils.testing.capture¶
- Overview:
Utilities for capturing different kinds of results, which can be useful in testing.
capture_output¶
-
hbutils.testing.capture.
capture_output
() → AbstractContextManager[hbutils.testing.capture.output.OutputCaptureResult][source]¶ - Overview:
Capture all the output to
sys.stdout
andsys.stderr
in thiswith
block.- Examples::
>>> from hbutils.testing import capture_output >>> import sys >>> >>> with capture_output() as r: ... print('this is stdout') ... print('this is stderr', file=sys.stderr) ... >>> r.stdout 'this is stdout\n' >>> r.stderr 'this is stderr\n'