test(google-genai): skip the vcrpy aiohttp workaround on fixed vcrpy - #276
Open
pylaterreur wants to merge 1 commit into
Open
pylaterreur wants to merge 1 commit into
pylaterreur wants to merge 1 commit into
Conversation
pylaterreur
force-pushed
the
google-genai-vcrpy-1055
branch
from
September 30, 2026 21:56
6f7f63f to
1bcc693
Compare
The patch_vcr_aiohttp_stream fixture in test_e2e.py works around kevin1024/vcrpy#927. kevin1024/vcrpy#1055 fixes that bug in vcrpy itself, and with it the fixture makes every async replay fail with a TypeError. Skip the fixture when vcrpy's MockStream is an aiohttp StreamReader, which is only the case with that fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GwUvhmzgfkiZ6vo4uGyesN
pylaterreur
force-pushed
the
google-genai-vcrpy-1055
branch
from
September 30, 2026 22:00
1bcc693 to
2fe6c5a
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
tests/generate_content/test_e2e.pyhas an autouse fixture,patch_vcr_aiohttp_stream, that works around kevin1024/vcrpy#927 by subclassing vcrpy'sMockStreamandMockClientResponse. kevin1024/vcrpy#1055 (not released yet) fixes that bug in vcrpy itself: a replayed response keeps a single aiohttpStreamReaderascontent, andMockStreamnow takes the body. With it, the fixture makes every async replay fail withTypeError: MockStream.__init__() missing 1 required positional argument: 'body'. pytest-vcr doesn't pin vcrpy, so the-latestenvironments will pick up that release unchanged.The fixture now returns early when vcrpy has the fix, detected with
issubclass(aiohttp_stubs.MockStream, aiohttp.StreamReader)because the vcrpy version that will ship it isn't known yet. With vcrpy 8.3.0 nothing changes.Upstream opentelemetry-python-contrib has since removed this package (open-telemetry/opentelemetry-python-contrib#5017). If you plan to drop it here too, feel free to close this.
Type of change
How Has This Been Tested?
pytest instrumentation-genai/opentelemetry-instrumentation-google-genai/tests --vcr-record=none, offline, with the-latestdependencies, on Python 3.10, 3.12 and 3.14:ruffandpylintare clean.Does This PR Require a Core Repo Change?
Checklist:
🤖 Generated with Claude Code
https://claude.ai/code/session_01GwUvhmzgfkiZ6vo4uGyesN