Skip to content

Commit 5b77bc4

Browse files
committed
Test relay-locking
1 parent 36f9ba9 commit 5b77bc4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/test_usb.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,14 @@ async def test_node_relay_and_power(self, monkeypatch: pytest.MonkeyPatch) -> No
788788
assert not await self.test_relay_state_off
789789
assert not stick.nodes["0098765432101234"].relay
790790

791+
# Test blocked async switching due to relay-lock active
792+
stick.nodes["0098765432101234"].set_relay_lock(True)
793+
with pytest.raises(pw_exceptions.NodeError):
794+
await stick.nodes["0098765432101234"].set_relay(True)
795+
assert not stick.nodes["0098765432101234"].relay
796+
# Make sure to turn lock off for further testing
797+
stick.nodes["0098765432101234"].set_relay_lock(False)
798+
791799
# Test async switching back from off to on
792800
self.test_relay_state_on = asyncio.Future()
793801
assert await stick.nodes["0098765432101234"].set_relay(True)

0 commit comments

Comments
 (0)