cyr-ius / heatzypy

GNU General Public License v3.0
0 stars 1 forks source link

Tests are failing and RuntimeError when importing #48

Open fabaff opened 2 months ago

fabaff commented 2 months ago

Currently the tests are failing. Tested with Python 3.12.

$ python -m unittest 
EE
======================================================================
ERROR: heatzypy (unittest.loader._FailedTest.heatzypy)
----------------------------------------------------------------------
ImportError: Failed to import test module: heatzypy
Traceback (most recent call last):
  File "/etc/profiles/per-user/fab/lib/python3.12/unittest/loader.py", line 429, in _find_test_path
    package = self._get_module_from_name(name)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/profiles/per-user/fab/lib/python3.12/unittest/loader.py", line 339, in _get_module_from_name
    __import__(name)
  File "/home/fab/heatzypy/heatzypy/__init__.py", line 10, in <module>
    from .heatzy import HeatzyClient
  File "/home/fab/heatzypy/heatzypy/heatzy.py", line 17, in <module>
    class HeatzyClient:
  File "/home/fab/heatzypy/heatzypy/heatzy.py", line 24, in HeatzyClient
    session: ClientSession = ClientSession(),
                             ^^^^^^^^^^^^^^^
  File "/home/fab/heatzypy/lib/python3.12/site-packages/aiohttp/client.py", line 294, in __init__
    loop = loop or asyncio.get_running_loop()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop

======================================================================
ERROR: tests.test_connection (unittest.loader._FailedTest.tests.test_connection)
----------------------------------------------------------------------
ImportError: Failed to import test module: tests.test_connection
Traceback (most recent call last):
  File "/etc/profiles/per-user/fab/lib/python3.12/unittest/loader.py", line 396, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/profiles/per-user/fab/lib/python3.12/unittest/loader.py", line 339, in _get_module_from_name
    __import__(name)
  File "/home/fab/heatzypy/tests/test_connection.py", line 11, in <module>
    from heatzypy import AuthenticationFailed, HeatzyClient, TimeoutExceededError
  File "/home/fab/heatzypy/heatzypy/__init__.py", line 10, in <module>
    from .heatzy import HeatzyClient
  File "/home/fab/heatzypy/heatzypy/heatzy.py", line 17, in <module>
    class HeatzyClient:
  File "/home/fab/heatzypy/heatzypy/heatzy.py", line 24, in HeatzyClient
    session: ClientSession = ClientSession(),
                             ^^^^^^^^^^^^^^^
  File "/home/fab/heatzypy/lib/python3.12/site-packages/aiohttp/client.py", line 294, in __init__
    loop = loop or asyncio.get_running_loop()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop

----------------------------------------------------------------------
Ran 2 tests in 0.000s

FAILED (errors=2)

One step more:

$ python
Python 3.12.5 (main, Aug  6 2024, 19:08:49) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from heatzypy import HeatzyClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/fab/heatzypy/heatzypy/__init__.py", line 10, in <module>
    from .heatzy import HeatzyClient
  File "/home/fab/heatzypy/heatzypy/heatzy.py", line 17, in <module>
    class HeatzyClient:
  File "/home/fab/heatzypy/heatzypy/heatzy.py", line 24, in HeatzyClient
    session: ClientSession = ClientSession(),
                             ^^^^^^^^^^^^^^^
  File "/home/fab/heatzypy/lib/python3.12/site-packages/aiohttp/client.py", line 294, in __init__
    loop = loop or asyncio.get_running_loop()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop
flyingtortue commented 1 month ago

Same issue here