captured_stderr
Capture the output of sys.stderr:
with captured_stderr() as stderr:
print("hello", file=sys.stderr)
self.assertEqual(stderr.getvalue(), "hello\n")
def captured_stderr() - > ContextManager
Capture the output of sys.stderr:
Returns
| Type | Description |
|---|---|
ContextManager | A context manager that yields a StringIO object containing the captured stderr output |