def setUp(self):
super(CaptureStandardIO, self).setUp()
self.patcher = MonkeyPatcher()
self.addCleanup(self.patcher.restore)
# Patch sys.std* and self.std*. Use TextIOWrapper to provide an
# identical API to the "real" stdin, stdout, and stderr objects.
self._addStream("stdin", self._wrapStream(self._buf_in))
self._addStream("stdout", self._wrapStream(self._buf_out))
self._addStream("stderr", self._wrapStream(self._buf_err))
self.patcher.patch()
评论列表
文章目录