test: block curl_cffi in the offline lane and mock Yahoo's retry path - #63
Merged
Merged
Conversation
The offline network guard patches Python's socket module, but yfinance sends through curl_cffi, whose libcurl opens sockets in C. Three offline Yahoo tests mocked yf.download only; an empty download then retries through yf.Ticker(...).history, which reached Yahoo live. CI on PR #61 failed on Windows with YFRateLimitError from one of them. The guard now rejects curl_cffi Session and AsyncSession requests, with probe tests for both, and the three tests mock the Ticker retry. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6TR4nQDjiPtanA2n4F3Gw
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.
The offline network guard in
tests/conftest.pypatches Python'ssocketmodule, but yfinance sends throughcurl_cffi, whose libcurl opens sockets in C. Three offline Yahoo tests mockedyf.downloadonly; an empty download retries throughyf.Ticker(...).history, which reached Yahoo live. PR #61's Windows job failed withYFRateLimitErrorfrom one of them.curl_cffiSessionandAsyncSessionrequests; two probe tests cover it (both failed before the change).test_empty_response_handling,test_empty_data_raises_symbol_not_foundandtest_propagates_symbol_not_found_errormock theTickerretry.Local: 3656 offline tests pass, ruff, ty.
🤖 Generated with Claude Code
https://claude.ai/code/session_01F6TR4nQDjiPtanA2n4F3Gw