Skip to content

Commit

Permalink
Test to ensure locks are released on error
Browse files Browse the repository at this point in the history
  • Loading branch information
rwb27 committed Aug 23, 2021
1 parent ed7855e commit 8bdc522
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_sync_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,13 @@ def g():
with pytest.raises(lock.LockError):
with this_lock(timeout=0.01):
pass

class DummyException(Exception):
pass

def test_rlock_released_after_error(this_lock):
try:
with this_lock:
raise DummyException()
except DummyException:
assert not this_lock.locked()

0 comments on commit 8bdc522

Please sign in to comment.