def test_lock_check(): test_lock = RedLock("test_lock_check") assert test_lock.check() == False test_lock.acquire() assert test_lock.check() == True test_lock.release() assert test_lock.check() == False
def test_lock_extend(): test_lock = RedLock("test_lock_extend", ttl=2000) test_lock.acquire() time.sleep(1) test_lock.extend() time.sleep(1.5) assert test_lock.check() == True