fwestenberg / reolink

Python Reolink package
MIT License
86 stars 24 forks source link

Test failures #83

Open fabaff opened 2 years ago

fabaff commented 2 years ago

Describe the bug

Starting with 0.56 I see some test failures:

============================= test session starts ==============================
platform linux -- Python 3.9.6, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /build/source
collected 9 items / 6 deselected / 3 selected                                  

test.py FFF                                                              [100%]

=================================== FAILURES ===================================
__________________________ TestLogin.test_wrong_host ___________________________

self = <test.TestLogin testMethod=test_wrong_host>

    def test_wrong_host(self):
        api = Api(
            host="192.168.1.0",
            port=self._port,
            username=self._user,
            password=self._password,
        )
>       assert not self._loop.run_until_complete(api.login())

test.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/lib/python3.9/asyncio/base_events.py:642: in run_until_complete
    return future.result()
reolink/camera_api.py:828: in login
    response = await self.send(body, param)
reolink/camera_api.py:1610: in send
    async with self._aiohttp_session.post(
/nix/store/dshms9cp7bwdgadfjdb61635nsl3sl77-python3.9-aiohttp-3.8.0/lib/python3.9/site-packages/aiohttp/client.py:1140: in __aenter__
    self._resp = await self._coro
/nix/store/dshms9cp7bwdgadfjdb61635nsl3sl77-python3.9-aiohttp-3.8.0/lib/python3.9/site-packages/aiohttp/client.py:466: in _request
    with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.helpers.TimerContext object at 0x7ffff5ad06d0>

    def __enter__(self) -> BaseTimerContext:
        task = current_task(loop=self._loop)

        if task is None:
>           raise RuntimeError(
                "Timeout context manager should be used " "inside a task"
            )
E           RuntimeError: Timeout context manager should be used inside a task

/nix/store/dshms9cp7bwdgadfjdb61635nsl3sl77-python3.9-aiohttp-3.8.0/lib/python3.9/site-packages/aiohttp/helpers.py:698: RuntimeError
________________________ TestLogin.test_wrong_password _________________________

self = <test.TestLogin testMethod=test_wrong_password>

    def test_wrong_password(self):
        api = Api(
            host=self._host, port=self._port, username=self._user, password="wrongpass"
        )
>       assert not self._loop.run_until_complete(api.login())

test.py:42: 
[...]

I haven't check if this is related to aiohttp >= 3.8.

To Reproduce Run tests

Expected behavior That the tests pass.

Screenshots n/a

Environment: n/a

Additional context n/a