Improve testing harness to allow tests on real devices (#197)

* test_cli: provide return values to patched objects to avoid warning about non-awaited calls

* test_cli: restore alias after testing

* smartstrip: remove internal update() calls for turn_{on,off}, set_led

* Make sure power is always a float

* Fix discovery tests

* Make tests runnable on real devices

* Add a note about running tests on a real device

* test_strip: run update against the parent device
This commit is contained in:
Teemu R
2021-09-19 23:45:48 +02:00
committed by GitHub
parent b088596205
commit 1803a83ae6
14 changed files with 70 additions and 24 deletions

View File

@@ -66,6 +66,7 @@ async def test_hsv(dev, turn_on):
await dev.set_hsv(hue=1, saturation=1, value=1)
await dev.update()
hue, saturation, brightness = dev.hsv
assert hue == 1
assert saturation == 1
@@ -134,6 +135,7 @@ async def test_variable_temp_state_information(dev):
async def test_try_set_colortemp(dev, turn_on):
await handle_turn_on(dev, turn_on)
await dev.set_color_temp(2700)
await dev.update()
assert dev.color_temp == 2700
@@ -179,9 +181,11 @@ async def test_dimmable_brightness(dev, turn_on):
assert dev.is_dimmable
await dev.set_brightness(50)
await dev.update()
assert dev.brightness == 50
await dev.set_brightness(10)
await dev.update()
assert dev.brightness == 10
with pytest.raises(ValueError):