From 45024f63a7eb353be91a4c3090e79dc5afdac7aa Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 1 Dec 2021 09:14:18 -0800 Subject: [PATCH] Correct the error_in_stream_unary test (#28229) --- src/python/grpcio_tests/tests_aio/unit/server_test.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/python/grpcio_tests/tests_aio/unit/server_test.py b/src/python/grpcio_tests/tests_aio/unit/server_test.py index 8a6995e99aa..2f0f6de1100 100644 --- a/src/python/grpcio_tests/tests_aio/unit/server_test.py +++ b/src/python/grpcio_tests/tests_aio/unit/server_test.py @@ -191,7 +191,7 @@ class _GenericHandler(grpc.GenericRpcHandler): assert _REQUEST == request request_count += 1 if request_count >= 1: - raise ValueError('The test server has a bug!') + raise ValueError('A testing RuntimeError!') async def _error_without_raise_in_unary_unary(self, request, context): assert _REQUEST == request @@ -527,13 +527,9 @@ class TestServer(AioTestBase): async def test_error_in_stream_unary(self): stream_unary_call = self._channel.stream_unary(_ERROR_IN_STREAM_UNARY) - finished = False - - def request_gen(): + async def request_gen(): for _ in range(_NUM_STREAM_REQUESTS): yield _REQUEST - nonlocal finished - finished = True call = stream_unary_call(request_gen()) @@ -541,7 +537,6 @@ class TestServer(AioTestBase): await call rpc_error = exception_context.exception self.assertEqual(grpc.StatusCode.UNKNOWN, rpc_error.code()) - self.assertEqual(finished, False) async def test_port_binding_exception(self): server = aio.server(options=(('grpc.so_reuseport', 0),))