def test_lock_context_manager(self): with Locking.with_lock(lock_name='test', reason='locking test'): with self.assertRaises(InternalError): Locking.lock(lock_name='test', reason='locking test') Locking.lock(lock_name='test', reason='locking test') Locking.unlock(lock_name='test')
def test_is_locked(self): Locking.lock(lock_name='test', reason='locking test') self.assertTrue(Locking.is_locked(lock_name='test')) Locking.unlock(lock_name='test') self.assertFalse(Locking.is_locked(lock_name='test'))