Skip to content

Commit 3e94b35

Browse files
committed
refactor test
1 parent a3578fa commit 3e94b35

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

Lib/test/_test_multiprocessing.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,21 +2046,16 @@ def test_sleeping_count_with_tiny_timeout(self):
20462046
self.skipTest('test not appropriate for {}'.format(self.TYPE))
20472047

20482048
cond = self.Condition()
2049-
# start some processes
2050-
workers = []
20512049
n = 3
2052-
2053-
for i in range(n):
2054-
p = self.Process(target=self._new_wait, args=(cond, 0.001))
2055-
workers.append(p)
2056-
p.start()
2057-
time.sleep(DELTA*2)
2050+
for _ in range(n):
2051+
self._new_wait(cond, 0.0)
20582052
# Sempahore.locked() is equivalent to
20592053
# Semaphore._semlock._is_zero()
20602054
self.assertTrue(cond._sleeping_count.locked())
20612055
self.assertTrue(cond._woken_count.locked())
20622056

2063-
for i in range(n):
2057+
workers = []
2058+
for _ in range(n):
20642059
p = self.Process(target=self._new_wait, args=(cond,))
20652060
workers.append(p)
20662061
p.start()

0 commit comments

Comments
 (0)