Fix the test_time_remaining test

pull/22290/head
Lidi Zheng 5 years ago
parent d9c55675c4
commit 2c783d7905
  1. 8
      src/python/grpcio_tests/tests_aio/unit/call_test.py

@ -457,16 +457,16 @@ class TestUnaryStreamCall(_MulticallableTestMixin, AioTestBase):
# Should be around the same as the timeout
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 * 5 / 2)
response = await call.read()
self.assertEqual(_RESPONSE_PAYLOAD_SIZE, len(response.payload.body))
# Should be around the timeout minus a unit of wait time
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())

Loading…
Cancel
Save