def test_try_shared_variation_when_already_share_locked(self): lock = self.make_lock(random_objid()) with lock_held_in_other_thread(lock.SHARED): with lock.SHARED: pass # No exception.
def test_try_shared_variation_when_already_exclusively_locked(self): lock = self.make_lock(random_objid()) with lock_held_in_other_thread(lock): self.assertRaises(dblocks.DatabaseLockNotHeld, lock.TRY.SHARED.__enter__)