Skip to content

Commit c8985b6

Browse files
author
Uziel Silva
committed
fix(main): Add support for Python 3.9
1 parent d8c23a2 commit c8985b6

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

google/cloud/sql/connector/connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ async def close_async(self) -> None:
491491
proxy_task = asyncio.gather(self._proxy)
492492
try:
493493
await asyncio.wait_for(proxy_task, timeout=0.1)
494-
except TimeoutError:
494+
except (asyncio.CancelledError, asyncio.TimeoutError, TimeoutError):
495495
pass # This task runs forever so it is expected to throw this exception
496496

497497

tests/unit/test_connector.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ async def test_Connector_connect_local_proxy(
317317
mock_connect.assert_called_once()
318318
mock_proxy.assert_called_once()
319319
assert connection is True
320+
321+
proxy_task = asyncio.gather(task)
322+
try:
323+
await asyncio.wait_for(proxy_task, timeout=0.1)
324+
except (asyncio.CancelledError, asyncio.TimeoutError, TimeoutError):
325+
pass # This task runs forever so it is expected to throw this exception
320326

321327

322328
@pytest.mark.asyncio

tests/unit/test_proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async def test_proxy_creates_folder(context: ssl.SSLContext, kwargs: Any) -> Non
4444
proxy_task = asyncio.gather(task)
4545
try:
4646
await asyncio.wait_for(proxy_task, timeout=0.1)
47-
except TimeoutError:
47+
except (asyncio.CancelledError, asyncio.TimeoutError, TimeoutError):
4848
pass # This task runs forever so it is expected to throw this exception
4949

5050
@pytest.mark.usefixtures("proxy_server")

0 commit comments

Comments
 (0)