Skip to content

Commit 3e0ec91

Browse files
committed
found a problem
1 parent 8275688 commit 3e0ec91

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

packages/service-library/tests/redis/test_semaphore.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -506,26 +506,17 @@ async def test_semaphore_context_manager_with_exception(
506506
semaphore_capacity: int,
507507
exception: type[Exception | asyncio.CancelledError],
508508
):
509-
captured_semaphore: DistributedSemaphore | None = None
510-
511509
async def _raising_context():
512510
async with distributed_semaphore(
513511
redis_client=redis_client_sdk,
514512
key=semaphore_name,
515513
capacity=semaphore_capacity,
516-
) as sem:
517-
nonlocal captured_semaphore
518-
captured_semaphore = sem
514+
):
519515
raise exception("Test")
520516

521517
with pytest.raises(exception, match="Test"):
522518
await _raising_context()
523519

524-
# Should be released even after exception
525-
assert captured_semaphore is not None
526-
# captured_semaphore is guaranteed to be not None by the assert above
527-
assert await captured_semaphore.current_count() == 0
528-
529520

530521
async def test_semaphore_context_manager_lost_renewal(
531522
redis_client_sdk: RedisClientSDK,

0 commit comments

Comments
 (0)