File tree Expand file tree Collapse file tree 1 file changed +1
-10
lines changed
packages/service-library/tests/redis Expand file tree Collapse file tree 1 file changed +1
-10
lines changed Original file line number Diff line number Diff 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
530521async def test_semaphore_context_manager_lost_renewal (
531522 redis_client_sdk : RedisClientSDK ,
You can’t perform that action at this time.
0 commit comments