Skip to content

Commit

Permalink
Correct the error_in_stream_unary test (#28229)
Browse files Browse the repository at this point in the history
  • Loading branch information
lidizheng committed Dec 1, 2021
1 parent 64b2061 commit 45024f6
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/python/grpcio_tests/tests_aio/unit/server_test.py
Expand Up @@ -191,7 +191,7 @@ async def _value_error_in_stream_unary(self, request_iterator, context):
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
Expand Down Expand Up @@ -527,21 +527,16 @@ async def test_error_without_raise_in_stream_stream(self):
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())

with self.assertRaises(aio.AioRpcError) as exception_context:
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),))
Expand Down

0 comments on commit 45024f6

Please sign in to comment.