Skip to content

Commit be1f512

Browse files
committed
Rearrage test location, skip fork test on windows
1 parent 40da262 commit be1f512

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

Lib/test/test_thread.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -337,18 +337,6 @@ def func():
337337
handle = thread.start_joinable_thread(func, handle=None)
338338
handle.join()
339339

340-
def test_forked_not_started(self):
341-
handle = thread._ThreadHandle()
342-
pid = os.fork()
343-
if pid == 0:
344-
# child process
345-
try:
346-
self.assertTrue(handle.is_alive())
347-
self.assertFalse(handle.is_done())
348-
finally:
349-
os._exit(0)
350-
else:
351-
support.wait_process(pid, exitcode=0)
352340

353341
class Barrier:
354342
def __init__(self, num_threads):
@@ -451,6 +439,21 @@ def fork_thread(read_fd, write_fd):
451439
self.assertIsNotNone(pid)
452440
support.wait_process(pid, exitcode=0)
453441

442+
@support.requires_fork()
443+
@threading_helper.reap_threads
444+
def test_forked_not_started(self):
445+
handle = thread._ThreadHandle()
446+
pid = os.fork()
447+
if pid == 0:
448+
# child process
449+
try:
450+
self.assertTrue(handle.is_alive())
451+
self.assertFalse(handle.is_done())
452+
finally:
453+
os._exit(0)
454+
else:
455+
support.wait_process(pid, exitcode=0)
456+
454457
def tearDown(self):
455458
try:
456459
os.close(self.read_fd)

0 commit comments

Comments
 (0)