Skip to content

Commit

Permalink
mock create_channel
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sanche committed Nov 12, 2024
1 parent 39f12f1 commit 99dd32a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tests/unit/data/_async/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,16 @@ async def test__manage_channel_sleeps(
]
client = self._make_client(project="project-id")
client.transport._grpc_channel = channel
try:
if refresh_interval is not None:
await client._manage_channel(
refresh_interval, refresh_interval, grace_period=0
)
else:
await client._manage_channel(grace_period=0)
except asyncio.CancelledError:
pass
with mock.patch.object(client.transport, "create_channel", CrossSync.Mock):
try:
if refresh_interval is not None:
await client._manage_channel(
refresh_interval, refresh_interval, grace_period=0
)
else:
await client._manage_channel(grace_period=0)
except asyncio.CancelledError:
pass
assert sleep.call_count == num_cycles
total_sleep = sum([call[0][1] for call in sleep.call_args_list])
assert (
Expand Down

0 comments on commit 99dd32a

Please sign in to comment.