Swamp-Ig / pizone

Python interface to iZone aircon controller.
GNU General Public License v3.0
12 stars 11 forks source link

Failing test - test_discovery: {'SystemMODE': 'cool'} != 'cool' #21

Open EdwardBetts opened 3 months ago

EdwardBetts commented 3 months ago
============================= test session starts ==============================
platform linux -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/edward/src/2024/vendor/pizone
configfile: pyproject.toml
plugins: aiohttp-1.0.5, timeout-2.3.1, tornasync-0.6.0.post2, pytest_httpserver-1.0.10, benchmark-4.0.0, arraydiff-0.6.1, trio-0.8.0, respx-0.21.1, anyio-4.4.0, syrupy-4.6.1, cov-5.0.0, asyncio-0.20.3, aresponses-3.0.0, lazy-fixtures-1.0.7, Faker-26.0.0, astropy-0.11.0, astropy-header-0.2.2, kgb-7.1.1, remotedata-0.4.1, typeguard-4.3.0, httpx-0.30.0, xdist-3.6.1, mock-3.14.0, filter-subpackage-0.2.0, doctestplus-1.2.1, requests-mock-1.12.1, hypothesis-6.105.1
asyncio: mode=Mode.STRICT
collected 13 items

tests/test_discovery.py .....F

=================================== FAILURES ===================================
________________________________ test_discovery ________________________________

service = <tests.conftest.MockDiscoveryService object at 0x7f95d66f19a0>

    async def test_discovery(service):
        assert len(service.controllers) == 1
        assert "000000001" in service.controllers

        controller = service.controllers["000000001"]  # type: Controller
        assert controller.device_uid == "000000001"
        assert controller.device_ip == "8.8.8.8"
        assert controller.mode == Controller.Mode.HEAT

        await controller.set_mode(Controller.Mode.COOL)
>       assert controller.sent[0] == ("SystemMODE", "cool")
E       AssertionError: assert ('SystemMODE'...ODE': 'cool'}) == ('SystemMODE', 'cool')
E         
E         At index 1 diff: {'SystemMODE': 'cool'} != 'cool'
E         Use -v to get more diff

tests/test_discovery.py:78: AssertionError
=============================== warnings summary ===============================
tests/test_discovery.py::test_broadcast
  /usr/lib/python3/dist-packages/tornado/ioloop.py:274: DeprecationWarning: There is no current event loop
    loop = asyncio.get_event_loop()

tests/test_discovery.py::test_fail_on_connect
tests/test_discovery.py::test_connection_lost
tests/test_discovery.py::test_discovery
  /home/edward/src/2024/vendor/pizone/pizone/discovery.py:287: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    self._send_broadcasts()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_discovery.py::test_discovery - AssertionError: assert ('Sys...
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
=================== 1 failed, 5 passed, 4 warnings in 0.19s ====================
$