-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Hi,
I shall say at the very beginning, I am new to the home assistant custom component development and new to python too, so I think I get something missing but I cannot find any result from google.
What I have done so far is just clone this repo, setup a venv by python -m venv venv, activate the venv and then to pip install pytest-homeassistant-custom-componet. Every things look OK so far. But when I try to run pytest in this repo, I get the following error
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ERROR at setup of test_sensor ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
fixturedef = <FixtureDef argname='event_loop' scope='function' baseid=''>, request = <SubRequest 'event_loop' for <Function test_sensor>>
@pytest.hookimpl(hookwrapper=True)
def pytest_fixture_setup(
fixturedef: FixtureDef, request: SubRequest
) -> Optional[object]:
"""Adjust the event loop policy when an event loop is produced."""
if fixturedef.argname == "event_loop":
outcome = yield
> loop = outcome.get_result()
venv\lib\site-packages\pytest_asyncio\plugin.py:399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
venv\lib\site-packages\pytest_asyncio\plugin.py:513: in event_loop
loop = asyncio.get_event_loop_policy().new_event_loop()
venv\lib\site-packages\homeassistant\runner.py:104: in new_event_loop
loop: asyncio.AbstractEventLoop = super().new_event_loop()
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\asyncio\events.py:673: in new_event_loop
return self._loop_factory()
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\asyncio\windows_events.py:315: in __init__
super().__init__(proactor)
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py:636: in __init__
self._make_self_pipe()
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py:767: in _make_self_pipe
self._ssock, self._csock = socket.socketpair()
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\socket.py:630: in socketpair
lsock = socket(family, type, proto)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'pytest_socket.disable_socket.<locals>.GuardedSocket'>, family = <AddressFamily.AF_INET: 2>, type = <SocketKind.SOCK_STREAM: 1>, proto = 0, fileno = None
def __new__(cls, family=-1, type=-1, proto=-1, fileno=None):
if _is_unix_socket(family) and allow_unix_socket:
return super().__new__(cls, family, type, proto, fileno)
> raise SocketBlockedError()
E pytest_socket.SocketBlockedError: A test tried to use socket.socket.
venv\lib\site-packages\pytest_socket.py:80: SocketBlockedError
I get the same error even on my dummy test which just contain assert(True). Apparently I didn't try to open any socket. How can I get rid of this issue?
Your help and advice would be much appreciated. Thanks!
Metadata
Metadata
Assignees
Labels
No labels