Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 6eda8c1

Browse files
fix: test fixes for the unit test3.9
Signed-off-by: Radhika Agrawal <agrawalradhika@google.com>
1 parent 0ec1bff commit 6eda8c1

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

google/auth/aio/transport/sessions.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ def _remaining_time():
6363

6464
async def with_timeout(coro):
6565
try:
66-
remaining = _remaining_time()
66+
try:
67+
remaining = _remaining_time()
68+
except TimeoutError:
69+
# If we timeout before starting the call,
70+
# we must close the coroutine to avoid leaks.
71+
if hasattr(coro, "close"):
72+
coro.close()
73+
raise
6774
response = await asyncio.wait_for(coro, remaining)
6875
return response
6976
except (asyncio.TimeoutError, TimeoutError) as e:

0 commit comments

Comments
 (0)