Skip to content

test(google-genai): remove vcrpy aiohttp workaround fixed in vcrpy 8.5.0 - #377

Open
pylaterreur wants to merge 1 commit into
signalfx:mainfrom
pylaterreur:vcrpy-1055-aiohttp-workaround
Open

pylaterreur wants to merge 1 commit into
signalfx:mainfrom
pylaterreur:vcrpy-1055-aiohttp-workaround

Conversation

@pylaterreur

@pylaterreur pylaterreur commented Sep 30, 2026 •

Copy link
Copy Markdown

Summary

The autouse patch_vcr_aiohttp_stream fixture in tests/generate_content/test_e2e.py works around kevin1024/vcrpy#927 by replacing vcrpy's MockClientResponse with a subclass whose content property caches one stream. vcrpy 8.5.0, released on 2026-10-25, includes kevin1024/vcrpy#1055, which fixes that bug: content is a plain attribute holding one aiohttp StreamReader, and MockStream requires the body. With vcrpy 8.5.0 or newer, every async replay in this module fails with TypeError: MockStream.__init__() missing 1 required positional argument: 'body', because aiohttp's close() reads content and the fixture's property calls _ReplayMockStream() without a body. The test requirements don't pin vcrpy, so a fresh environment gets such a release. CI doesn't run these tests.

Changes

Validation

test_e2e.py replayed with --vcr-record=none on Python 3.12 (google-genai 1.64.0, aiohttp 3.14.5), one process per test, since in one session only the first test sees spans (the TelemetryHandler singleton isn't reset):

vcrpy main this PR
8.4.0 8 of 12 pass 6 of 12 pass
8.5.0 4 of 12 pass 8 of 12 pass
9.1.0 4 of 12 pass 8 of 12 pass

On 8.4.0, the two test_streaming[*-async-default] cases never finish without the fixture (kevin1024/vcrpy#927, stopped by pytest-timeout after 60 s). The 4 test_upload_hook_non_streaming cases fail on main with every vcrpy version. ruff check and ruff format --check pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GwUvhmzgfkiZ6vo4uGyesN

@pylaterreur
pylaterreur requested review from a team as code owners September 30, 2026 23:42
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@pylaterreur

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

The patch_vcr_aiohttp_stream fixture in test_e2e.py works around
kevin1024/vcrpy#927 with a MockClientResponse subclass whose `content`
property caches one stream. vcrpy 8.5.0 includes kevin1024/vcrpy#1055,
which fixes that bug: `content` is a plain attribute holding one
aiohttp StreamReader, and MockStream requires the body. With vcrpy
8.5.0 or newer, the fixture makes every async replay in this module
fail with a TypeError: aiohttp's close() reads `content`, and the
property then creates _ReplayMockStream() without a body. The test
requirements don't pin vcrpy, so a fresh environment gets such a
release.

Remove the fixture and the imports only it used, and require vcrpy
8.5.0 or newer in requirements.latest.txt.
@pylaterreur pylaterreur changed the title test(google-genai): skip vcrpy aiohttp workaround if vcrpy has the fix test(google-genai): remove vcrpy aiohttp workaround fixed in vcrpy 8.5.0 Oct 25, 2026
@pylaterreur
pylaterreur force-pushed the vcrpy-1055-aiohttp-workaround branch from 7399e6d to a61dca8 Compare October 25, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant