mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-07-12 21:08:13 +00:00
fix(prediction): green up CI for the new PV providers (mypy + provider sequence)
- Use urllib.parse.quote instead of requests.utils.quote in the pvnode and Solcast providers: the runtime re-export exists, but the requests type stubs do not declare it, so the pre-commit mypy hook failed with 'Module has no attribute "quote"'. - Mark the force_update keyword in the new provider tests with `# type: ignore` — it is consumed by the cache_in_file decorator at runtime; same call convention and ignore style as pvforecastakkudoktor.py. - Add PVForecastPVNode, PVForecastForecastSolar and PVForecastSolcast to the expected provider sequence in tests/test_prediction.py (fixture + index assertions) — the two sequence tests failed because the new providers were registered in prediction.py but missing from the hardcoded expectations.
This commit is contained in:
@@ -84,7 +84,9 @@ def test_plane_url_converts_azimuth(config_eos):
|
||||
config=config_eos.load, start_datetime=pendulum.datetime(2025, 1, 1, tz="UTC")
|
||||
)
|
||||
with patch("requests.get", return_value=_http({})) as mock_get:
|
||||
pv._request_forecast(force_update=True)
|
||||
# force_update is consumed by the cache_in_file decorator at runtime
|
||||
# (same call convention as pvforecastakkudoktor.py).
|
||||
pv._request_forecast(force_update=True) # type: ignore
|
||||
url = mock_get.call_args[0][0]
|
||||
assert url == "https://api.forecast.solar/secret/estimate/52.5/13.4/25.0/90.0/7.5"
|
||||
|
||||
@@ -106,7 +108,7 @@ def test_request_forecast_sums_planes(config_eos):
|
||||
_http({"2025-01-01 12:00:00": 800.0}),
|
||||
]
|
||||
with patch("requests.get", side_effect=responses) as mock_get:
|
||||
body = pv._request_forecast(force_update=True)
|
||||
body = pv._request_forecast(force_update=True) # type: ignore
|
||||
assert mock_get.call_count == 2
|
||||
assert body["watts"]["2025-01-01 12:00:00"] == 1800.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user