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:
Christin
2026-07-04 09:23:57 +00:00
parent 6f4a26a045
commit d4dc9fa662
5 changed files with 25 additions and 10 deletions

View File

@@ -129,7 +129,9 @@ def test_request_forecast_inline_post_when_no_site(config_eos):
pv = PVForecastPVNode(config=config_eos.load, start_datetime=pendulum.datetime(2025, 1, 1, tz="UTC"))
fake = type("R", (), {"raise_for_status": lambda self: None, "json": lambda self: {"values": []}})()
with patch("requests.post", return_value=fake) as mock_post:
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_post.call_args[0][0]
assert url.endswith("/v2/forecast/inline")
body = mock_post.call_args.kwargs["json"]