Skip to content

Commit 10f3dc9

Browse files
committed
remove test-debug message
fix testing by providing cache-data to SED
1 parent 1498e45 commit 10f3dc9

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

plugwise_usb/nodes/sed.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,6 @@ def _clock_interval_from_cache(self) -> int | None:
190190

191191
def _clock_sync_from_cache(self) -> bool | None:
192192
"""Load clock sync state from cache."""
193-
_LOGGER.debug(
194-
"MDI: Bool: %s", str(self._get_cache_as_bool(CACHE_SED_CLOCK_SYNC))
195-
)
196193
return self._get_cache_as_bool(CACHE_SED_CLOCK_SYNC)
197194

198195
def _maintenance_interval_from_cache(self) -> int | None:

tests/test_usb.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,6 +2417,33 @@ async def test_node_discovery_and_load( # noqa: PLR0915
24172417
self, monkeypatch: pytest.MonkeyPatch
24182418
) -> None:
24192419
"""Testing discovery of nodes."""
2420+
2421+
def fake_cache(dummy: object, setting: str) -> str | None: # noqa: PLR0911
2422+
"""Fake cache retrieval."""
2423+
if setting == pw_node.CACHE_FIRMWARE:
2424+
return "2011-5-13-7-26-54"
2425+
if setting == pw_node.CACHE_HARDWARE:
2426+
return "080029"
2427+
if setting == pw_node.CACHE_NODE_INFO_TIMESTAMP:
2428+
return "2024-12-7-1-0-0"
2429+
if setting == pw_node.CACHE_RELAY:
2430+
return "True"
2431+
if setting == pw_sed.CACHE_SED_AWAKE_DURATION:
2432+
return "10"
2433+
if setting == pw_sed.CACHE_SED_CLOCK_INTERVAL:
2434+
return "25200"
2435+
if setting == pw_sed.CACHE_SED_CLOCK_SYNC:
2436+
return False
2437+
if setting == pw_sed.CACHE_SED_MAINTENANCE_INTERVAL:
2438+
return "60"
2439+
if setting == pw_sed.CACHE_SED_SLEEP_DURATION:
2440+
return "60"
2441+
if setting == pw_sed.CACHE_SED_DIRTY:
2442+
return False
2443+
return None
2444+
2445+
monkeypatch.setattr(pw_node.PlugwiseBaseNode, "_get_cache", fake_cache)
2446+
monkeypatch.setattr(pw_node.PlugwiseBaseNode, "_get_cache_as_bool", fake_cache)
24202447
mock_serial = MockSerial(None)
24212448
monkeypatch.setattr(
24222449
pw_connection_manager,

0 commit comments

Comments
 (0)