ci: run pytest in CI; complete dev requirements; unblock socket test
The suite was never run in CI (only hassfest/HACS), and requirements-dev listed only pytest + smartthings-local while conftest.py needs the full Home Assistant test harness. - requirements-dev.txt: add pytest-homeassistant-custom-component (pulls in home-assistant + pytest + pytest-socket) and the integration's runtime deps (cbor2, pyOpenSSL, cryptography) needed to import it. - .github/workflows/validate.yml: add a Pytest job on Python 3.14 (current Home Assistant's floor) that installs requirements-dev and runs the suite. - test_config_flow.py: the UDP liveness-sweep test needs real loopback sockets, which the HA harness blocks by default; take the pytest-socket socket_enabled fixture so it runs instead of erroring. Full suite: 249 passed.
This commit is contained in:
3 files changed
+35
-2
No files matched your search
@@ -67,7 +67,7 @@ def test_order_candidates_prefers_known_ports() -> None:
|
||||
assert _order_candidates([49153]) == [49153]
|
||||
|
||||
|
||||
def test_find_live_ports_detects_silent_port() -> None:
|
||||
def test_find_live_ports_detects_silent_port(socket_enabled) -> None:
|
||||
"""The UDP liveness sweep flags a bound-but-silent port as live and drops
|
||||
ports that refuse with ICMP port-unreachable.
|
||||
|
||||
@@ -75,6 +75,10 @@ def test_find_live_ports_detects_silent_port() -> None:
|
||||
stays silent (open|filtered), like the dishwasher in issue #13 on 49153.
|
||||
Two sibling ports are reserved then closed so loopback refuses datagrams
|
||||
to them, standing in for the closed ports the scan should discard.
|
||||
|
||||
`socket_enabled` lifts pytest-socket's default block (the HA test harness
|
||||
disables real sockets); this test genuinely needs loopback UDP to exercise
|
||||
the ICMP-unreachable path.
|
||||
"""
|
||||
import socket
|
||||
|
||||
|
||||
Reference in new issue
Block a user