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:
sobolevn 2025-04-08 11:14:12 +03:00 committed by GitHub
parent 6cd1d6c6b1
commit f7305a06c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 89 additions and 6 deletions

View file

@ -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()