diff options
Diffstat (limited to 'Lib/test/_test_multiprocessing.py')
-rw-r--r-- | Lib/test/_test_multiprocessing.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index db30e6b..80c95d6 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -425,6 +425,27 @@ class _TestProcess(BaseTestCase): self.assertEqual(q.get(), 5) close_queue(q) + @classmethod + def _test_error_on_stdio_flush(self, evt): + evt.set() + + def test_error_on_stdio_flush(self): + streams = [io.StringIO(), None] + streams[0].close() + for stream_name in ('stdout', 'stderr'): + for stream in streams: + old_stream = getattr(sys, stream_name) + setattr(sys, stream_name, stream) + try: + evt = self.Event() + proc = self.Process(target=self._test_error_on_stdio_flush, + args=(evt,)) + proc.start() + proc.join() + self.assertTrue(evt.is_set()) + finally: + setattr(sys, stream_name, old_stream) + # # |