Skip to content

Presubmit showcase (3.13, showcase_w_rest_async, google) fails at HEAD #2385

@parthea

Description

@parthea

Presubmit showcase (3.13, showcase_w_rest_async, google) fails at HEAD with the following failure:

........................................................................ [ 48%]
.....................................F.F................................ [ 97%]
....                                                                     [100%]
=================================== FAILURES ===================================
_________________ test_async_unary_stream_reader[rest_asyncio] _________________

async_echo = <google.showcase_v1beta1.services.echo.async_client.EchoAsyncClient object at 0x7fb1bc0fe9e0>

    @pytest.mark.asyncio
    async def test_async_unary_stream_reader(async_echo):
        content = "The hail in Wales falls mainly on the snails."
        stream = await async_echo.expand(
            {
                "content": content,
            },
            metadata=_METADATA,
        )
    
        # Note: gRPC exposes `read`, REST exposes `__anext__` to read
        # a chunk of response from the stream.
        response_attr = (
            "__anext__" if "rest" in str(async_echo.transport).lower() else "read"
        )
    
        # Consume the response and ensure it matches what we expect.
        for ground_truth in content.split(" "):
>           response = await getattr(stream, response_attr)()

tests/system/test_streams.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.nox/showcase_w_rest_async-3-13/lib/python3.13/site-packages/google/api_core/rest_streaming_async.py:79: in __anext__
    raise e
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <google.api_core.rest_streaming_async.AsyncResponseIterator object at 0x7fb1bc1cdd10>

    async def __anext__(self):
        while not self._ready_objs:
            try:
>               chunk = await self._response_itr.__anext__()
E               StopAsyncIteration

.nox/showcase_w_rest_async-3-13/lib/python3.13/site-packages/google/api_core/rest_streaming_async.py:73: StopAsyncIteration

The change is related to google-auth 2.40.0 released yesterday.

The issue is that the response is read in the auth library via the new code await response.json() which was added, and as a result, when tests run there is no response left to read.

https://github.com/googleapis/google-auth-library-python/blob/0bebddda369b27b5ec4acec2073310b0b8a35461/google/auth/aio/_helpers.py#L39

There is a breaking change, since code works prior to 2.40.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions