From 22c7138943bdc4e401cb04eaad96ec4fc33462eb Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 24 Jun 2026 17:56:54 -0400 Subject: [PATCH] test: fix dead assert in retry streaming tests causing coverage issues The assert statement was incorrectly indented inside the pytest.raises context manager, causing it to never execute. Dedented the assert to ensure exception messages are actually verified, which also resolves coverage gaps. --- .../tests/asyncio/retry/test_retry_streaming_async.py | 2 +- .../google-api-core/tests/unit/retry/test_retry_streaming.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-api-core/tests/asyncio/retry/test_retry_streaming_async.py b/packages/google-api-core/tests/asyncio/retry/test_retry_streaming_async.py index e44f5361e112..f2473849eaad 100644 --- a/packages/google-api-core/tests/asyncio/retry/test_retry_streaming_async.py +++ b/packages/google-api-core/tests/asyncio/retry/test_retry_streaming_async.py @@ -293,7 +293,7 @@ async def test___call___generator_send_retry(self, sleep): generator = await retry_(self._generator_mock)(error_on=3) with pytest.raises(TypeError) as exc_info: await generator.asend("cannot send to fresh generator") - assert exc_info.match("can't send non-None value") + assert exc_info.match("can't send non-None value") await generator.aclose() # error thrown on 3 diff --git a/packages/google-api-core/tests/unit/retry/test_retry_streaming.py b/packages/google-api-core/tests/unit/retry/test_retry_streaming.py index 2499b2ae9512..1fb3a80c1a3a 100644 --- a/packages/google-api-core/tests/unit/retry/test_retry_streaming.py +++ b/packages/google-api-core/tests/unit/retry/test_retry_streaming.py @@ -263,7 +263,7 @@ def test___call___with_generator_send_retry(self, sleep): with pytest.raises(TypeError) as exc_info: # calling first send with non-None input should raise a TypeError result.send("can not send to fresh generator") - assert exc_info.match("can't send non-None value") + assert exc_info.match("can't send non-None value") # initiate iteration with None result = retry_(self._generator_mock)(error_on=3) assert result.send(None) == 0