File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,6 @@ def test_rlock_block(this_lock):
68
68
69
69
# Override owner to force acquisition failure
70
70
this_lock ._owner = None
71
- print (this_lock ._owner )
72
71
# Assert not owner
73
72
assert not this_lock ._is_owned ()
74
73
@@ -88,22 +87,30 @@ def test_rlock_block(this_lock):
88
87
89
88
# Release lock, assert no owner
90
89
assert not this_lock ._is_owned ()
91
-
92
- def test_rlock_acquire_timeout (this_lock ):
90
+
91
+
92
+ def test_rlock_acquire_timeout_pass (this_lock ):
93
+ # Assert acquisition fails using context manager
94
+ with this_lock (timeout = 0.01 ) as result :
95
+ assert result is True
96
+
97
+ assert not this_lock .locked ()
98
+
99
+
100
+ def test_rlock_acquire_timeout_fail (this_lock ):
93
101
from labthings .core .exceptions import LockError
94
102
95
103
# Acquire lock
96
104
assert this_lock .acquire ()
97
105
98
106
# Override owner to force acquisition failure
99
107
this_lock ._owner = None
100
- print (this_lock ._owner )
101
108
# Assert not owner
102
109
assert not this_lock ._is_owned ()
103
110
104
111
# Assert acquisition fails using context manager
105
112
with pytest .raises (LockError ):
106
- with this_lock (timeout = 0.01 ):
113
+ with this_lock (timeout = 0.01 ) as result :
107
114
pass
108
115
109
116
# Force ownership
You can’t perform that action at this time.
0 commit comments