diff --git a/src/python/grpcio_tests/tests_aio/unit/channel_test.py b/src/python/grpcio_tests/tests_aio/unit/channel_test.py index 934dc8de95c..3a17b045c8b 100644 --- a/src/python/grpcio_tests/tests_aio/unit/channel_test.py +++ b/src/python/grpcio_tests/tests_aio/unit/channel_test.py @@ -91,7 +91,7 @@ class TestChannel(AioTestBase): ) call = hi(messages_pb2.SimpleRequest(), - timeout=UNARY_CALL_WITH_SLEEP_VALUE * 2) + timeout=UNARY_CALL_WITH_SLEEP_VALUE * 5) self.assertEqual(await call.code(), grpc.StatusCode.OK) async def test_unary_stream(self): diff --git a/src/python/grpcio_tests/tests_aio/unit/interceptor_test.py b/src/python/grpcio_tests/tests_aio/unit/interceptor_test.py index f461e3fdd65..9970178d0cd 100644 --- a/src/python/grpcio_tests/tests_aio/unit/interceptor_test.py +++ b/src/python/grpcio_tests/tests_aio/unit/interceptor_test.py @@ -392,16 +392,14 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): async def test_cancel_before_rpc(self): interceptor_reached = asyncio.Event() + wait_for_ever = self.loop.create_future() class Interceptor(aio.UnaryUnaryClientInterceptor): async def intercept_unary_unary(self, continuation, client_call_details, request): interceptor_reached.set() - await asyncio.sleep(0) - - # This line should never be reached - raise Exception() + await wait_for_ever async with aio.insecure_channel(self._server_target, interceptors=[Interceptor() @@ -433,6 +431,7 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): async def test_cancel_after_rpc(self): interceptor_reached = asyncio.Event() + wait_for_ever = self.loop.create_future() class Interceptor(aio.UnaryUnaryClientInterceptor): @@ -441,10 +440,7 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): call = await continuation(client_call_details, request) await call interceptor_reached.set() - await asyncio.sleep(0) - - # This line should never be reached - raise Exception() + await wait_for_ever async with aio.insecure_channel(self._server_target, interceptors=[Interceptor()