Skip to content

Commit 5255fbb

Browse files
chore: use sync instead of async in test (#396)
`test_Connector_remove_cached_bad_instance` doesn't need to be async, because it can use the event loop that is generated by `Connector.__init__()` function.
1 parent e8fbbdf commit 5255fbb

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

tests/unit/test_connector.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_Connector_close_called_multiple_times(credentials: FakeCredentials) ->
209209
connector.close()
210210

211211

212-
async def test_Connector_remove_cached_bad_instance(
212+
def test_Connector_remove_cached_bad_instance(
213213
credentials: FakeCredentials,
214214
) -> None:
215215
"""When a Connector attempts to retrieve connection info for a
@@ -219,14 +219,8 @@ async def test_Connector_remove_cached_bad_instance(
219219
"""
220220
instance_uri = "projects/test-project/locations/test-region/clusters/test-cluster/instances/bad-test-instance"
221221
with Connector(credentials) as connector:
222-
connector._keys = asyncio.wrap_future(
223-
asyncio.run_coroutine_threadsafe(
224-
generate_keys(), asyncio.get_running_loop()
225-
),
226-
loop=asyncio.get_running_loop(),
227-
)
228222
with pytest.raises(ClientResponseError):
229-
await connector.connect_async(instance_uri, "pg8000")
223+
connector.connect(instance_uri, "pg8000")
230224
assert instance_uri not in connector._cache
231225

232226

0 commit comments

Comments
 (0)