We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 879a65a commit 226a5cfCopy full SHA for 226a5cf
tests/test_recipes.py
@@ -28,6 +28,26 @@ def test_averager(cache):
28
assert nums.pop() == 9.5
29
30
31
+def test_lock(cache):
32
+ state = {'num': 0}
33
+ lock = dc.Lock(cache, 'demo')
34
+
35
+ def worker():
36
+ state['num'] += 1
37
+ with lock:
38
+ assert lock.locked()
39
40
+ time.sleep(0.1)
41
42
43
+ thread = threading.Thread(target=worker)
44
+ thread.start()
45
46
+ assert state['num'] == 1
47
+ thread.join()
48
+ assert state['num'] == 2
49
50
51
def test_rlock(cache):
52
state = {'num': 0}
53
rlock = dc.RLock(cache, 'demo')
0 commit comments