File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -677,15 +677,27 @@ def test_expire_at(self, cache: RedisCache):
677
677
678
678
def test_lock (self , cache : RedisCache ):
679
679
lock = cache .lock ("foobar" )
680
- lock .acquire (blocking = True )
680
+ assert lock .acquire (blocking = True )
681
+
682
+ assert cache .has_key ("foobar" )
683
+ lock .release ()
684
+ assert not cache .has_key ("foobar" )
685
+
686
+ def test_lock_not_blocking (self , cache : RedisCache ):
687
+ lock = cache .lock ("foobar" )
688
+ assert lock .acquire (blocking = False )
689
+
690
+ lock2 = cache .lock ("foobar" )
691
+
692
+ assert not lock2 .acquire (blocking = False )
681
693
682
694
assert cache .has_key ("foobar" )
683
695
lock .release ()
684
696
assert not cache .has_key ("foobar" )
685
697
686
698
def test_lock_released_by_thread (self , cache : RedisCache ):
687
699
lock = cache .lock ("foobar" , thread_local = False )
688
- lock .acquire (blocking = True )
700
+ assert lock .acquire (blocking = True )
689
701
690
702
def release_lock (lock_ ):
691
703
lock_ .release ()
You can’t perform that action at this time.
0 commit comments