mirror of
https://github.com/python/cpython.git
synced 2025-08-29 05:05:03 +00:00
gh-115942: Add locked
to several multiprocessing locks (#115944)
Co-authored-by: mpage <mpage@cs.stanford.edu> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
parent
6cd1d6c6b1
commit
f7305a06c7
10 changed files with 89 additions and 6 deletions
|
@ -353,6 +353,18 @@ class RLockTests(BaseLockTests):
|
|||
lock.release()
|
||||
self.assertRaises(RuntimeError, lock.release)
|
||||
|
||||
def test_locked(self):
|
||||
lock = self.locktype()
|
||||
self.assertFalse(lock.locked())
|
||||
lock.acquire()
|
||||
self.assertTrue(lock.locked())
|
||||
lock.acquire()
|
||||
self.assertTrue(lock.locked())
|
||||
lock.release()
|
||||
self.assertTrue(lock.locked())
|
||||
lock.release()
|
||||
self.assertFalse(lock.locked())
|
||||
|
||||
def test_release_save_unacquired(self):
|
||||
# Cannot _release_save an unacquired lock
|
||||
lock = self.locktype()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue