Skip to content

Commit 28b6274

Browse files
committed
pythongh-130730: Fix flaky test_active_children test
Use an Event object instead of time.sleep().
1 parent cfa0b1d commit 28b6274

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/test/_test_multiprocessing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,13 +589,15 @@ def test_cpu_count(self):
589589
def test_active_children(self):
590590
self.assertEqual(type(self.active_children()), list)
591591

592-
p = self.Process(target=time.sleep, args=(DELTA,))
592+
event = self.Event()
593+
p = self.Process(target=event.wait)
593594
self.assertNotIn(p, self.active_children())
594595

595596
p.daemon = True
596597
p.start()
597598
self.assertIn(p, self.active_children())
598599

600+
event.set()
599601
p.join()
600602
self.assertNotIn(p, self.active_children())
601603

0 commit comments

Comments
 (0)