diff options
Diffstat (limited to 'Lib/test/_test_multiprocessing.py')
-rw-r--r-- | Lib/test/_test_multiprocessing.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index fd3b430..ead92cf 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -826,7 +826,7 @@ class _TestSubclassingProcess(BaseTestCase): proc = self.Process(target=self._test_stderr_flush, args=(testfn,)) proc.start() proc.join() - with open(testfn, 'r') as f: + with open(testfn, encoding="utf-8") as f: err = f.read() # The whole traceback was printed self.assertIn("ZeroDivisionError", err) @@ -836,14 +836,14 @@ class _TestSubclassingProcess(BaseTestCase): @classmethod def _test_stderr_flush(cls, testfn): fd = os.open(testfn, os.O_WRONLY | os.O_CREAT | os.O_EXCL) - sys.stderr = open(fd, 'w', closefd=False) + sys.stderr = open(fd, 'w', encoding="utf-8", closefd=False) 1/0 # MARKER @classmethod def _test_sys_exit(cls, reason, testfn): fd = os.open(testfn, os.O_WRONLY | os.O_CREAT | os.O_EXCL) - sys.stderr = open(fd, 'w', closefd=False) + sys.stderr = open(fd, 'w', encoding="utf-8", closefd=False) sys.exit(reason) def test_sys_exit(self): @@ -864,7 +864,7 @@ class _TestSubclassingProcess(BaseTestCase): join_process(p) self.assertEqual(p.exitcode, 1) - with open(testfn, 'r') as f: + with open(testfn, encoding="utf-8") as f: content = f.read() self.assertEqual(content.rstrip(), str(reason)) @@ -1118,7 +1118,7 @@ class _TestQueue(BaseTestCase): def test_no_import_lock_contention(self): with os_helper.temp_cwd(): module_name = 'imported_by_an_imported_module' - with open(module_name + '.py', 'w') as f: + with open(module_name + '.py', 'w', encoding="utf-8") as f: f.write("""if 1: import multiprocessing |