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

Method captured_stderr_with_buffer

Lib/test/test_calendar.py:1083–1092  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1081
1082 @contextlib.contextmanager
1083 def captured_stderr_with_buffer(self):
1084 orig_stderr = sys.stderr
1085 buffer = io.BytesIO()
1086 sys.stderr = io.TextIOWrapper(buffer)
1087 try:
1088 yield sys.stderr
1089 finally:
1090 sys.stderr.flush()
1091 sys.stderr.buffer.seek(0)
1092 sys.stderr = orig_stderr
1093
1094 def run_cli_ok(self, *args):
1095 with self.captured_stdout_with_buffer() as stdout:

Callers 1

assertCLIFailsMethod · 0.95

Calls 2

flushMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected