test: fix forecast csv mock target - #363
Open
timothykou wants to merge 1 commit into
Open
Conversation
6 tasks
Author
|
CI note: the visible red |
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.
Pull Request
Description
Addresses #231.
This is a small test-only follow-up to the slow CI/unit-test investigation.
tests/unit/test_generate_forecast.pyalready tried to mockrun_forecast, but it patchedquartz_solar_forecast.forecast.run_forecast. The code under test importsrun_forecastdirectly intoquartz_solar_forecast.utils.forecast_csv, so the mock did not intercept the call and the unit test still exercised the real forecast path.This changes the test to patch
quartz_solar_forecast.utils.forecast_csv.run_forecast, which is the symbol actually used bywrite_out_forecasts.Performance / CI relevance:
test_generate_forecastmade 5 live Open-Meteo calls.Open-Meteo calls: 0.0.01swith--durations=0.This intentionally does not try to solve all of #231 in one PR. Other unit tests still make live Open-Meteo calls, so this is a narrow first step rather than a full closure.
How Has This Been Tested?
Results:
All checks passed!1 passed; slowest call0.01sopenmeteo_requests.Client.weather_apipatched to fail:1 passed,Open-Meteo calls: 0I also ran the full unit suite with a local
requests-cache==1.3.2override because currentmainis affected by the separaterequests-cache==1.2.0issue:Result:
22 passed, 4 warnings in 171.77s. The suite is still slow because other unit tests continue to call live weather APIs; those should be addressed separately.Checklist: