diff options
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r-- | Lib/test/test_threading.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index a8f3c13..f03a642 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -505,7 +505,7 @@ class ThreadTests(BaseTestCase): t = threading.Thread(daemon=True) self.assertTrue(t.daemon) - @unittest.skipUnless(hasattr(os, 'fork'), 'needs os.fork()') + @support.requires_fork() def test_fork_at_exit(self): # bpo-42350: Calling os.fork() after threading._shutdown() must # not log an error. @@ -533,7 +533,7 @@ class ThreadTests(BaseTestCase): self.assertEqual(out, b'') self.assertEqual(err.rstrip(), b'child process ok') - @unittest.skipUnless(hasattr(os, 'fork'), 'test needs fork()') + @support.requires_fork() def test_dummy_thread_after_fork(self): # Issue #14308: a dummy thread in the active list doesn't mess up # the after-fork mechanism. @@ -560,7 +560,7 @@ class ThreadTests(BaseTestCase): self.assertEqual(out, b'') self.assertEqual(err, b'') - @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @support.requires_fork() def test_is_alive_after_fork(self): # Try hard to trigger #18418: is_alive() could sometimes be True on # threads that vanished after a fork. @@ -594,7 +594,7 @@ class ThreadTests(BaseTestCase): th.start() th.join() - @unittest.skipUnless(hasattr(os, 'fork'), "test needs os.fork()") + @support.requires_fork() @unittest.skipUnless(hasattr(os, 'waitpid'), "test needs os.waitpid()") def test_main_thread_after_fork(self): code = """if 1: @@ -616,7 +616,7 @@ class ThreadTests(BaseTestCase): self.assertEqual(data, "MainThread\nTrue\nTrue\n") @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") - @unittest.skipUnless(hasattr(os, 'fork'), "test needs os.fork()") + @support.requires_fork() @unittest.skipUnless(hasattr(os, 'waitpid'), "test needs os.waitpid()") def test_main_thread_after_fork_from_nonmain_thread(self): code = """if 1: @@ -993,7 +993,7 @@ class ThreadJoinOnShutdown(BaseTestCase): """ self._run_and_join(script) - @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @support.requires_fork() @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_2_join_in_forked_process(self): # Like the test above, but from a forked interpreter @@ -1014,7 +1014,7 @@ class ThreadJoinOnShutdown(BaseTestCase): """ self._run_and_join(script) - @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @support.requires_fork() @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_3_join_in_forked_from_thread(self): # Like the test above, but fork() was called from a worker thread @@ -1085,7 +1085,7 @@ class ThreadJoinOnShutdown(BaseTestCase): rc, out, err = assert_python_ok('-c', script) self.assertFalse(err) - @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @support.requires_fork() @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_reinit_tls_after_fork(self): # Issue #13817: fork() would deadlock in a multithreaded program with @@ -1109,7 +1109,7 @@ class ThreadJoinOnShutdown(BaseTestCase): for t in threads: t.join() - @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @support.requires_fork() def test_clear_threads_states_after_fork(self): # Issue #17094: check that threads states are cleared after fork() |