Merge pull request #9080 from nathanielmanistaatgoogle/channel_ready_future_tests-v1.0.x

Channel ready future test tweaks.
pull/9094/head
Nathaniel Manista 8 years ago committed by GitHub
commit d0966d031d
  1. 4
      src/python/grpcio_tests/tests/unit/_channel_ready_future_test.py
  2. 4
      src/python/grpcio_tests/tests/unit/beta/_utilities_test.py

@ -66,7 +66,7 @@ class ChannelReadyFutureTest(unittest.TestCase):
ready_future = grpc.channel_ready_future(channel) ready_future = grpc.channel_ready_future(channel)
ready_future.add_done_callback(callback.accept_value) ready_future.add_done_callback(callback.accept_value)
with self.assertRaises(grpc.FutureTimeoutError): with self.assertRaises(grpc.FutureTimeoutError):
ready_future.result(test_constants.SHORT_TIMEOUT) ready_future.result(timeout=test_constants.SHORT_TIMEOUT)
self.assertFalse(ready_future.cancelled()) self.assertFalse(ready_future.cancelled())
self.assertFalse(ready_future.done()) self.assertFalse(ready_future.done())
self.assertTrue(ready_future.running()) self.assertTrue(ready_future.running())
@ -86,7 +86,7 @@ class ChannelReadyFutureTest(unittest.TestCase):
ready_future = grpc.channel_ready_future(channel) ready_future = grpc.channel_ready_future(channel)
ready_future.add_done_callback(callback.accept_value) ready_future.add_done_callback(callback.accept_value)
self.assertIsNone(ready_future.result(test_constants.SHORT_TIMEOUT)) self.assertIsNone(ready_future.result(timeout=test_constants.LONG_TIMEOUT))
value_passed_to_callback = callback.block_until_called() value_passed_to_callback = callback.block_until_called()
self.assertIs(ready_future, value_passed_to_callback) self.assertIs(ready_future, value_passed_to_callback)
self.assertFalse(ready_future.cancelled()) self.assertFalse(ready_future.cancelled())

@ -66,7 +66,7 @@ class ChannelConnectivityTest(unittest.TestCase):
ready_future = utilities.channel_ready_future(channel) ready_future = utilities.channel_ready_future(channel)
ready_future.add_done_callback(callback.accept_value) ready_future.add_done_callback(callback.accept_value)
with self.assertRaises(future.TimeoutError): with self.assertRaises(future.TimeoutError):
ready_future.result(test_constants.SHORT_TIMEOUT) ready_future.result(timeout=test_constants.SHORT_TIMEOUT)
self.assertFalse(ready_future.cancelled()) self.assertFalse(ready_future.cancelled())
self.assertFalse(ready_future.done()) self.assertFalse(ready_future.done())
self.assertTrue(ready_future.running()) self.assertTrue(ready_future.running())
@ -88,7 +88,7 @@ class ChannelConnectivityTest(unittest.TestCase):
ready_future = utilities.channel_ready_future(channel) ready_future = utilities.channel_ready_future(channel)
ready_future.add_done_callback(callback.accept_value) ready_future.add_done_callback(callback.accept_value)
self.assertIsNone( self.assertIsNone(
ready_future.result(test_constants.SHORT_TIMEOUT)) ready_future.result(timeout=test_constants.LONG_TIMEOUT))
value_passed_to_callback = callback.block_until_called() value_passed_to_callback = callback.block_until_called()
self.assertIs(ready_future, value_passed_to_callback) self.assertIs(ready_future, value_passed_to_callback)
self.assertFalse(ready_future.cancelled()) self.assertFalse(ready_future.cancelled())

Loading…
Cancel
Save