Repository navigation
test: mock remaining network call in test_encode_invalid_audio_url_chunk - #192
Merged
juliendenize merged 2 commits intoMar 4, 2026
Merged
Conversation
test_encode_invalid_audio_url_chunk made a live HTTP request to example.com when testing the invalid URL error path. This is fragile as it depends on external availability and network conditions (e.g., SSL certificate verification on macOS). Replace with a mocked response following the same pattern established in test_audio.py (PR mistralai#188 by @framsouza). No behavior changes to production code.
juliendenize
approved these changes
Mar 4, 2026
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.
Summary
test_encode_invalid_audio_url_chunkintest_tokenizer_v7_audio.pymade a live HTTP request toexample.comwhen testing the invalid-URL error path. This is fragile: it depends on external host availability and can cause non-deterministic CI failures (e.g., SSL certificate verification issues on macOS with uv-managed Python).This PR replaces the live call with a mocked
requests.getthat raisesRequestException, following the same pattern established by @framsouza in #188 fortest_audio.py.Changes
mistral_common.audio.requests.getintest_encode_invalid_audio_url_chunkto simulate a failed network requestimport requeststotest_tokenizer_v7_audio.pyTest plan
uv run pytest tests/test_tokenizer_v7_audio.py::test_encode_invalid_audio_url_chunk -vpassesuv run pytest tests/ -vpasses (506 passed, 16 skipped)uv run ruff check .anduv run ruff format --check .passNo behavior changes to production code.