diff --git a/requirements_test.txt b/requirements_test.txt index a559438f2c9..d515e9d6f21 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -5,7 +5,7 @@ josepy<3 # https://github.com/aio-libs/aiodns/issues/214 pycares<5 pytest==8.4.2 -pytest-asyncio==0.26.0 +pytest-asyncio==1.4.0 pytest-cov==7.1.0 pytest-snapshot==0.9.0 pytest-socket==0.8.0 diff --git a/tests/conftest.py b/tests/conftest.py index e2b47d7fd19..c908c6f6a35 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -102,6 +102,16 @@ def connection(): return MagicMock() +@pytest.fixture +def event_loop(event_loop_policy): + """Provide compatibility event loop fixture for pytest-asyncio>=1.0.""" + loop = event_loop_policy.new_event_loop() + try: + yield loop + finally: + loop.close() + + @pytest.fixture def hass_storage(): """Fixture to mock storage."""