diff --git a/goodwe_controller/test_safety118.py b/goodwe_controller/test_safety118.py index f6fe602..e9cb1a9 100644 --- a/goodwe_controller/test_safety118.py +++ b/goodwe_controller/test_safety118.py @@ -17,7 +17,6 @@ Mutating a module this file grades? Read MUTATION.md first (purge __pycache__). import asyncio import logging -from pathlib import Path import os # noqa: E402 import sys # noqa: E402 @@ -371,7 +370,8 @@ check("pv.unit_fault: None for a good unit and for a missing reading (has_readin pv.unit_fault(st(1, "kW")) is None and pv.unit_fault(None) is None and pv.unit_fault(st("unavailable")) is None and pv.unit_fault(st(1)) == "" and pv.unit_fault(st(1, "kWh")) == "kWh") -src = (Path(__file__).parent / "app" / "main.py").read_text(encoding="utf-8") +# MAINT-21: main.py and the files split from it (the forecast read is in ctl_inputs). +src = main_files.source() check("the size rule is gone from main.py", "abs(raw) < 50" not in src) print() diff --git a/goodwe_controller/test_validate.py b/goodwe_controller/test_validate.py index ea9c5df..6cfff7c 100644 --- a/goodwe_controller/test_validate.py +++ b/goodwe_controller/test_validate.py @@ -1028,6 +1028,11 @@ check("...and the drain SET is not clamped either, so the twin key the card " _srcs = {name: open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "app", name), encoding="utf-8").read() for name in ("main.py", "validate.py", "maintenance.py")} +# MAINT-21: main.py stands for itself and the files split from it. +sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), + "tools")) +import main_files # noqa: E402 +_srcs["main.py"] = main_files.source() _literals = {name: re.findall( r'"(maintenance_[a-z_]+)"\s*,\s*(-?\d+(?:\.\d+)?)\s*[,)]', src) for name, src in _srcs.items()}