Skip to content

Commit 8bdc522

Browse files
committed
Test to ensure locks are released on error
1 parent ed7855e commit 8bdc522

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test_sync_lock.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,13 @@ def g():
108108
with pytest.raises(lock.LockError):
109109
with this_lock(timeout=0.01):
110110
pass
111+
112+
class DummyException(Exception):
113+
pass
114+
115+
def test_rlock_released_after_error(this_lock):
116+
try:
117+
with this_lock:
118+
raise DummyException()
119+
except DummyException:
120+
assert not this_lock.locked()

0 commit comments

Comments
 (0)