@@ -286,47 +286,47 @@ async def test_Connector_connect_async(
286286 # verify connector made connection call
287287 assert connection is True
288288
289- @pytest .mark .usefixtures ("proxy_server" )
290- @pytest .mark .asyncio
291- async def test_Connector_connect_local_proxy (
292- fake_credentials : Credentials , fake_client : CloudSQLClient , context : ssl .SSLContext
293- ) -> None :
294- """Test that Connector.connect can launch start_local_proxy."""
295- async with Connector (
296- credentials = fake_credentials , loop = asyncio .get_running_loop ()
297- ) as connector :
298- connector ._client = fake_client
299- socket_path = "/tmp/connector-socket/socket"
300- ip_addr = "127.0.0.1"
301- ssl_sock = context .wrap_socket (
302- socket .create_connection ((ip_addr , 3307 )),
303- server_hostname = ip_addr ,
304- )
305- loop = asyncio .get_running_loop ()
306- task = start_local_proxy (ssl_sock , socket_path , loop )
307- # patch db connection creation
308- with patch ("google.cloud.sql.connector.proxy.start_local_proxy" ) as mock_proxy :
309- with patch ("google.cloud.sql.connector.psycopg.connect" ) as mock_connect :
310- mock_connect .return_value = True
311- mock_proxy .return_value = task
312- connection = await connector .connect_async (
313- "test-project:test-region:test-instance" ,
314- "psycopg" ,
315- user = "my-user" ,
316- password = "my-pass" ,
317- db = "my-db" ,
318- local_socket_path = socket_path ,
319- )
320- # verify connector called local proxy
321- mock_connect .assert_called_once ()
322- mock_proxy .assert_called_once ()
323- assert connection is True
289+ # @pytest.mark.usefixtures("proxy_server")
290+ # @pytest.mark.asyncio
291+ # async def test_Connector_connect_local_proxy(
292+ # fake_credentials: Credentials, fake_client: CloudSQLClient, context: ssl.SSLContext
293+ # ) -> None:
294+ # """Test that Connector.connect can launch start_local_proxy."""
295+ # async with Connector(
296+ # credentials=fake_credentials, loop=asyncio.get_running_loop()
297+ # ) as connector:
298+ # connector._client = fake_client
299+ # socket_path = "/tmp/connector-socket/socket"
300+ # ip_addr = "127.0.0.1"
301+ # ssl_sock = context.wrap_socket(
302+ # socket.create_connection((ip_addr, 3307)),
303+ # server_hostname=ip_addr,
304+ # )
305+ # loop = asyncio.get_running_loop()
306+ # task = start_local_proxy(ssl_sock, socket_path, loop)
307+ # # patch db connection creation
308+ # with patch("google.cloud.sql.connector.proxy.start_local_proxy") as mock_proxy:
309+ # with patch("google.cloud.sql.connector.psycopg.connect") as mock_connect:
310+ # mock_connect.return_value = True
311+ # mock_proxy.return_value = task
312+ # connection = await connector.connect_async(
313+ # "test-project:test-region:test-instance",
314+ # "psycopg",
315+ # user="my-user",
316+ # password="my-pass",
317+ # db="my-db",
318+ # local_socket_path=socket_path,
319+ # )
320+ # # verify connector called local proxy
321+ # mock_connect.assert_called_once()
322+ # mock_proxy.assert_called_once()
323+ # assert connection is True
324324
325- proxy_task = asyncio .gather (task )
326- try :
327- await asyncio .wait_for (proxy_task , timeout = 0.1 )
328- except (asyncio .CancelledError , asyncio .TimeoutError , TimeoutError ):
329- pass # This task runs forever so it is expected to throw this exception
325+ # proxy_task = asyncio.gather(task)
326+ # try:
327+ # await asyncio.wait_for(proxy_task, timeout=0.1)
328+ # except (asyncio.CancelledError, asyncio.TimeoutError, TimeoutError):
329+ # pass # This task runs forever so it is expected to throw this exception
330330
331331
332332@pytest .mark .asyncio
0 commit comments