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 00d13c5cbde..b7e4b233cb5 100644 --- a/src/python/grpcio_tests/tests_aio/unit/server_test.py +++ b/src/python/grpcio_tests/tests_aio/unit/server_test.py @@ -160,7 +160,7 @@ class _GenericHandler(grpc.GenericRpcHandler): def service(self, handler_details): self._called.set_result(None) - return self._routing_table[handler_details.method] + return self._routing_table.get(handler_details.method) async def wait_for_call(self): await self._called @@ -395,12 +395,11 @@ class TestServer(AioTestBase): await channel.unary_unary(_SIMPLE_UNARY_UNARY)(_REQUEST) async def test_unimplemented(self): - async with aio.insecure_channel(self._server_target) as channel: - call = channel.unary_unary(_UNIMPLEMENTED_METHOD) - with self.assertRaises(aio.AioRpcError) as exception_context: - await call(_REQUEST) - rpc_error = exception_context.exception - self.assertEqual(grpc.StatusCode.UNIMPLEMENTED, rpc_error.code()) + call = self._channel.unary_unary(_UNIMPLEMENTED_METHOD) + with self.assertRaises(aio.AioRpcError) as exception_context: + await call(_REQUEST) + rpc_error = exception_context.exception + self.assertEqual(grpc.StatusCode.UNIMPLEMENTED, rpc_error.code()) if __name__ == '__main__':