Skip to content

Commit a0471ca

Browse files
committed
WIP
1 parent c060eb3 commit a0471ca

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

Lib/test/_test_multiprocessing.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,12 +1496,6 @@ def _acquire_release(lock, timeout, l=None, n=1):
14961496
for _ in range(n):
14971497
lock.release()
14981498

1499-
@staticmethod
1500-
def _acquire_and_wait(lock, barrier, timeout=.1):
1501-
lock.acquire()
1502-
barrier.wait()
1503-
time.sleep(timeout)
1504-
15051499
def test_repr_rlock(self):
15061500
if self.TYPE != 'processes':
15071501
self.skipTest('test not appropriate for {}'.format(self.TYPE))
@@ -1528,13 +1522,10 @@ def test_repr_rlock(self):
15281522
self.assertIn(f'<RLock(MainProcess|T{i+1}, {i+1})>', l)
15291523

15301524
rlock = self.RLock()
1531-
barrier = self.Barrier(2)
1532-
t = threading.Thread(target=self._acquire_and_wait,
1533-
args=(rlock, barrier, .2))
1525+
t = threading.Thread(target=rlock.acquire)
15341526
t.start()
1535-
barrier.wait()
1536-
self.assertEqual('<RLock(SomeOtherThread, nonzero)>', repr(rlock))
15371527
t.join()
1528+
self.assertEqual('<RLock(SomeOtherThread, nonzero)>', repr(rlock))
15381529

15391530
pname = 'P1'
15401531
l = multiprocessing.Manager().list()
@@ -1545,14 +1536,11 @@ def test_repr_rlock(self):
15451536
p.join()
15461537
self.assertEqual(f'<RLock({pname}, 1)>', l[0])
15471538

1548-
barrier = self.Barrier(2)
1549-
lock = self.RLock()
1550-
p = self.Process(target=self._acquire_and_wait,
1551-
args=(lock, barrier, .2))
1539+
rlock = self.RLock()
1540+
p = self.Process(target=self._acquire, args=(rlock,))
15521541
p.start()
1553-
barrier.wait()
1554-
self.assertEqual('<RLock(SomeOtherProcess, nonzero)>', repr(lock))
15551542
p.join()
1543+
self.assertEqual('<RLock(SomeOtherProcess, nonzero)>', repr(rlock))
15561544

15571545
def test_rlock(self):
15581546
lock = self.RLock()

0 commit comments

Comments
 (0)