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

@@ -19,7 +19,10 @@ from akkudoktoreos.prediction.prediction import (
PredictionCommonSettings,
)
from akkudoktoreos.prediction.pvforecastakkudoktor import PVForecastAkkudoktor
from akkudoktoreos.prediction.pvforecastforecastsolar import PVForecastForecastSolar
from akkudoktoreos.prediction.pvforecastimport import PVForecastImport
from akkudoktoreos.prediction.pvforecastpvnode import PVForecastPVNode
from akkudoktoreos.prediction.pvforecastsolcast import PVForecastSolcast
from akkudoktoreos.prediction.pvforecastvrm import PVForecastVrm
from akkudoktoreos.prediction.weatherbrightsky import WeatherBrightSky
from akkudoktoreos.prediction.weatherclearoutside import WeatherClearOutside
@@ -49,6 +52,9 @@ def forecast_providers():
LoadImport(),
PVForecastAkkudoktor(),
PVForecastVrm(),
PVForecastPVNode(),
PVForecastForecastSolar(),
PVForecastSolcast(),
PVForecastImport(),
WeatherBrightSky(),
WeatherClearOutside(),
@@ -98,11 +104,14 @@ def test_provider_sequence(prediction):
assert isinstance(prediction.providers[9], LoadImport)
assert isinstance(prediction.providers[10], PVForecastAkkudoktor)
assert isinstance(prediction.providers[11], PVForecastVrm)
assert isinstance(prediction.providers[12], PVForecastImport)
assert isinstance(prediction.providers[13], WeatherBrightSky)
assert isinstance(prediction.providers[14], WeatherClearOutside)
assert isinstance(prediction.providers[15], WeatherOpenMeteo)
assert isinstance(prediction.providers[16], WeatherImport)
assert isinstance(prediction.providers[12], PVForecastPVNode)
assert isinstance(prediction.providers[13], PVForecastForecastSolar)
assert isinstance(prediction.providers[14], PVForecastSolcast)
assert isinstance(prediction.providers[15], PVForecastImport)
assert isinstance(prediction.providers[16], WeatherBrightSky)
assert isinstance(prediction.providers[17], WeatherClearOutside)
assert isinstance(prediction.providers[18], WeatherOpenMeteo)
assert isinstance(prediction.providers[19], WeatherImport)
def test_provider_by_id(prediction, forecast_providers):