MCPcopy Index your code
hub / github.com/python/cpython / captured_stdout

Function captured_stdout

Lib/test/test_xmlrpc.py:1421–1430  ·  view source on GitHub ↗

A variation on support.captured_stdout() which gives a text stream having a `buffer` attribute.

(encoding='utf-8')

Source from the content-addressed store, hash-verified

1419
1420@contextlib.contextmanager
1421def captured_stdout(encoding='utf-8'):
1422 """A variation on support.captured_stdout() which gives a text stream
1423 having a `buffer` attribute.
1424 """
1425 orig_stdout = sys.stdout
1426 sys.stdout = io.TextIOWrapper(io.BytesIO(), encoding=encoding)
1427 try:
1428 yield sys.stdout
1429 finally:
1430 sys.stdout = orig_stdout
1431
1432
1433class CGIHandlerTestCase(unittest.TestCase):

Callers 2

test_cgi_getMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…