From d81e1beacbbc50d3821f0b2897a0bd080d4045d1 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 18 Sep 2023 00:51:57 +0200 Subject: [PATCH] Fix additional test cases for Python 3.12 --- tests/components/hassio/test_handler.py | 2 +- tests/helpers/test_script.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/components/hassio/test_handler.py b/tests/components/hassio/test_handler.py index 5a89ea8335a91e..d92a5335809766 100644 --- a/tests/components/hassio/test_handler.py +++ b/tests/components/hassio/test_handler.py @@ -320,8 +320,8 @@ async def test_api_ingress_panels( ], ) async def test_api_headers( + aiohttp_raw_server, # 'aiohttp_raw_server' must be before 'hass'! hass, - aiohttp_raw_server, socket_enabled, api_call: str, method: Literal["GET", "POST"], diff --git a/tests/helpers/test_script.py b/tests/helpers/test_script.py index 5163dd0ca6d5a1..8e4409daa547de 100644 --- a/tests/helpers/test_script.py +++ b/tests/helpers/test_script.py @@ -1053,6 +1053,7 @@ async def test_multiple_runs_wait(hass: HomeAssistant, action_type) -> None: hass.states.async_set("switch.test", "on") hass.async_create_task(script_obj.async_run(context=Context())) await asyncio.wait_for(wait_started_flag.wait(), 1) + await asyncio.sleep(0) assert script_obj.is_running assert len(events) == 1 @@ -1062,6 +1063,7 @@ async def test_multiple_runs_wait(hass: HomeAssistant, action_type) -> None: wait_started_flag.clear() hass.async_create_task(script_obj.async_run()) await asyncio.wait_for(wait_started_flag.wait(), 1) + await asyncio.sleep(0) except (AssertionError, asyncio.TimeoutError): await script_obj.async_stop() raise @@ -4079,6 +4081,7 @@ async def test_script_mode_2( hass.states.async_set("switch.test", "on") hass.async_create_task(script_obj.async_run(context=Context())) await asyncio.wait_for(wait_started_flag.wait(), 1) + await asyncio.sleep(0) assert script_obj.is_running assert len(events) == 1 @@ -4089,6 +4092,7 @@ async def test_script_mode_2( wait_started_flag.clear() hass.async_create_task(script_obj.async_run(context=Context())) await asyncio.wait_for(wait_started_flag.wait(), 1) + await asyncio.sleep(0) assert script_obj.is_running assert len(events) == 2