Skip to content

Commit 5dc9ac1

Browse files
committed
better test
1 parent dbccba1 commit 5dc9ac1

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

packages/service-library/tests/test_redis.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,14 @@ async def test_issue_cannot_acquire_lock_anymore(
170170
redis_client_sdk: RedisClientSDK, faker: Faker
171171
):
172172
lock_name = faker.pystr()
173-
with pytest.raises(LockLostError):
173+
with pytest.raises(LockLostError): # noqa: PT012
174174
async with redis_client_sdk.lock_context(lock_name) as ttl_lock:
175175
assert await _is_locked(redis_client_sdk, lock_name) is True
176176
assert await ttl_lock.owned() is True
177-
# let's force release the lock
178-
await redis_client_sdk._client.delete(lock_name)
179-
177+
# let's simlulate lost lock by forcefully deleting it
178+
await redis_client_sdk._client.delete(lock_name) # noqa: SLF001
179+
# now we wait for the exception to be raised
180180
await asyncio.sleep(20)
181-
# assert await _is_locked(redis_client_sdk, lock_name) is False
182-
# assert await ttl_lock.owned() is False
183-
# actually it should even raise here
184181

185182

186183
async def test_lock_context_with_already_locked_lock_raises(

0 commit comments

Comments
 (0)