Browse Source

Make sanity tests happy

Lidi Zheng 5 years ago
parent
commit
0fc1d212aa

+ 3 - 3
src/python/grpcio/grpc/experimental/aio/_base_call.py

@@ -19,12 +19,12 @@ RPC, e.g. cancellation.
 """
 """
 
 
 from abc import ABCMeta, abstractmethod
 from abc import ABCMeta, abstractmethod
-from typing import (Any, AsyncIterable, Awaitable, Callable, Generic, Optional,
-                    Text, Union)
+from typing import AsyncIterable, Awaitable, Generic, Optional, Text, Union
 
 
 import grpc
 import grpc
 
 
-from ._typing import EOFType, MetadataType, RequestType, ResponseType, DoneCallbackType
+from ._typing import (DoneCallbackType, EOFType, MetadataType, RequestType,
+                      ResponseType)
 
 
 __all__ = 'RpcContext', 'Call', 'UnaryUnaryCall', 'UnaryStreamCall'
 __all__ = 'RpcContext', 'Call', 'UnaryUnaryCall', 'UnaryStreamCall'
 
 

+ 1 - 0
src/python/grpcio_tests/tests_aio/tests.json

@@ -9,6 +9,7 @@
   "unit.channel_argument_test.TestChannelArgument",
   "unit.channel_argument_test.TestChannelArgument",
   "unit.channel_test.TestChannel",
   "unit.channel_test.TestChannel",
   "unit.connectivity_test.TestConnectivityState",
   "unit.connectivity_test.TestConnectivityState",
+  "unit.done_callback_test.TestDoneCallback",
   "unit.init_test.TestInsecureChannel",
   "unit.init_test.TestInsecureChannel",
   "unit.init_test.TestSecureChannel",
   "unit.init_test.TestSecureChannel",
   "unit.interceptor_test.TestInterceptedUnaryUnaryCall",
   "unit.interceptor_test.TestInterceptedUnaryUnaryCall",

+ 7 - 8
src/python/grpcio_tests/tests_aio/unit/call_test.py

@@ -380,9 +380,7 @@ class TestUnaryStreamCall(_MulticallableTestMixin, AioTestBase):
         request = messages_pb2.StreamingOutputCallRequest()
         request = messages_pb2.StreamingOutputCallRequest()
         # First message comes back immediately
         # First message comes back immediately
         request.response_parameters.append(
         request.response_parameters.append(
-            messages_pb2.ResponseParameters(
-                size=_RESPONSE_PAYLOAD_SIZE,
-            ))
+            messages_pb2.ResponseParameters(size=_RESPONSE_PAYLOAD_SIZE,))
         # Second message comes back after a unit of wait time
         # Second message comes back after a unit of wait time
         request.response_parameters.append(
         request.response_parameters.append(
             messages_pb2.ResponseParameters(
             messages_pb2.ResponseParameters(
@@ -391,26 +389,27 @@ class TestUnaryStreamCall(_MulticallableTestMixin, AioTestBase):
             ))
             ))
 
 
         call = self._stub.StreamingOutputCall(
         call = self._stub.StreamingOutputCall(
-            request, timeout=test_constants.SHORT_TIMEOUT*2)
+            request, timeout=test_constants.SHORT_TIMEOUT * 2)
 
 
         response = await call.read()
         response = await call.read()
         self.assertEqual(_RESPONSE_PAYLOAD_SIZE, len(response.payload.body))
         self.assertEqual(_RESPONSE_PAYLOAD_SIZE, len(response.payload.body))
 
 
         # Should be around the same as the timeout
         # Should be around the same as the timeout
         remained_time = call.time_remaining()
         remained_time = call.time_remaining()
-        self.assertGreater(remained_time, test_constants.SHORT_TIMEOUT*3//2)
-        self.assertLess(remained_time, test_constants.SHORT_TIMEOUT*2)
+        self.assertGreater(remained_time, test_constants.SHORT_TIMEOUT * 3 // 2)
+        self.assertLess(remained_time, test_constants.SHORT_TIMEOUT * 2)
 
 
         response = await call.read()
         response = await call.read()
         self.assertEqual(_RESPONSE_PAYLOAD_SIZE, len(response.payload.body))
         self.assertEqual(_RESPONSE_PAYLOAD_SIZE, len(response.payload.body))
 
 
         # Should be around the timeout minus a unit of wait time
         # Should be around the timeout minus a unit of wait time
         remained_time = call.time_remaining()
         remained_time = call.time_remaining()
-        self.assertGreater(remained_time, test_constants.SHORT_TIMEOUT//2)
-        self.assertLess(remained_time, test_constants.SHORT_TIMEOUT*3//2)
+        self.assertGreater(remained_time, test_constants.SHORT_TIMEOUT // 2)
+        self.assertLess(remained_time, test_constants.SHORT_TIMEOUT * 3 // 2)
 
 
         self.assertEqual(grpc.StatusCode.OK, await call.code())
         self.assertEqual(grpc.StatusCode.OK, await call.code())
 
 
+
 class TestStreamUnaryCall(_MulticallableTestMixin, AioTestBase):
 class TestStreamUnaryCall(_MulticallableTestMixin, AioTestBase):
 
 
     async def test_cancel_stream_unary(self):
     async def test_cancel_stream_unary(self):