Преглед изворни кода

Tests: mark async tests so latest pytest does not skip them.

Latest pytest seems to skip async tests that are not explicitly annotated as async.
Jason Rumney пре 3 година
родитељ
комит
6d2b1f3f51

+ 4 - 0
tests/test_binary_sensor.py

@@ -1,5 +1,6 @@
 """Tests for the binary_sensor entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.binary_sensor import TuyaLocalBinarySe
 from custom_components.tuya_local.binary_sensor import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -36,6 +38,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_binary_sensor(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -60,6 +63,7 @@ async def test_init_entry_fails_if_device_has_no_binary_sensor(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(

+ 4 - 0
tests/test_climate.py

@@ -1,5 +1,6 @@
 """Tests for the light entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.climate import TuyaLocalClimate
 from custom_components.tuya_local.climate import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -65,6 +67,7 @@ async def test_init_entry(hass):
 #     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_climate(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -92,6 +95,7 @@ async def test_init_entry_fails_if_device_has_no_climate(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(

+ 17 - 0
tests/test_config_flow.py

@@ -36,6 +36,7 @@ def bypass_setup():
         yield
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test initialisation of the config flow."""
     entry = MockConfigEntry(
@@ -58,6 +59,7 @@ async def test_init_entry(hass):
     assert hass.states.get("lock.test_child_lock")
 
 
+@pytest.mark.asyncio
 @patch("custom_components.tuya_local.setup_device")
 async def test_migrate_entry(mock_setup, hass):
     """Test migration from old entry format."""
@@ -200,6 +202,7 @@ async def test_migrate_entry(mock_setup, hass):
     assert await async_migrate_entry(hass, entry)
 
 
+@pytest.mark.asyncio
 async def test_flow_user_init(hass):
     """Test the initialisation of the form in the first step of the config flow."""
     result = await hass.config_entries.flow.async_init(
@@ -231,6 +234,7 @@ async def test_flow_user_init(hass):
         pass
 
 
+@pytest.mark.asyncio
 @patch("custom_components.tuya_local.config_flow.TuyaLocalDevice")
 async def test_async_test_connection_valid(mock_device, hass):
     """Test that device is returned when connection is valid."""
@@ -249,6 +253,7 @@ async def test_async_test_connection_valid(mock_device, hass):
     assert device == mock_instance
 
 
+@pytest.mark.asyncio
 @patch("custom_components.tuya_local.config_flow.TuyaLocalDevice")
 async def test_async_test_connection_invalid(mock_device, hass):
     """Test that None is returned when connection is invalid."""
@@ -267,6 +272,7 @@ async def test_async_test_connection_invalid(mock_device, hass):
     assert device is None
 
 
+@pytest.mark.asyncio
 @patch("custom_components.tuya_local.config_flow.async_test_connection")
 async def test_flow_user_init_invalid_config(mock_test, hass):
     """Test errors populated when config is invalid."""
@@ -294,6 +300,7 @@ def setup_device_mock(mock, failure=False, type="test"):
     mock.async_possible_types = MagicMock(return_value=mock_iter)
 
 
+@pytest.mark.asyncio
 @patch("custom_components.tuya_local.config_flow.async_test_connection")
 async def test_flow_user_init_data_valid(mock_test, hass):
     """Test we advance to the next step when connection config is valid."""
@@ -314,6 +321,7 @@ async def test_flow_user_init_data_valid(mock_test, hass):
     assert "select_type" == result["step_id"]
 
 
+@pytest.mark.asyncio
 @patch.object(config_flow.ConfigFlowHandler, "device")
 async def test_flow_select_type_init(mock_device, hass):
     """Test the initialisation of the form in the 2nd step of the config flow."""
@@ -346,6 +354,7 @@ async def test_flow_select_type_init(mock_device, hass):
         pass
 
 
+@pytest.mark.asyncio
 @patch.object(config_flow.ConfigFlowHandler, "device")
 async def test_flow_select_type_aborts_when_no_match(mock_device, hass):
     """Test the flow aborts when an unsupported device is used."""
@@ -359,6 +368,7 @@ async def test_flow_select_type_aborts_when_no_match(mock_device, hass):
     assert result["reason"] == "not_supported"
 
 
+@pytest.mark.asyncio
 @patch.object(config_flow.ConfigFlowHandler, "device")
 async def test_flow_select_type_data_valid(mock_device, hass):
     """Test the flow continues when valid data is supplied."""
@@ -375,6 +385,7 @@ async def test_flow_select_type_data_valid(mock_device, hass):
     assert "choose_entities" == result["step_id"]
 
 
+@pytest.mark.asyncio
 async def test_flow_choose_entities_init(hass):
     """Test the initialisation of the form in the 3rd step of the config flow."""
 
@@ -407,6 +418,7 @@ async def test_flow_choose_entities_init(hass):
         pass
 
 
+@pytest.mark.asyncio
 async def test_flow_choose_entities_creates_config_entry(hass, bypass_setup):
     """Test the flow ends when data is valid."""
 
@@ -451,6 +463,7 @@ async def test_flow_choose_entities_creates_config_entry(hass, bypass_setup):
         assert expected == result
 
 
+@pytest.mark.asyncio
 async def test_options_flow_init(hass):
     """Test config flow options."""
     config_entry = MockConfigEntry(
@@ -484,6 +497,7 @@ async def test_options_flow_init(hass):
     )
 
 
+@pytest.mark.asyncio
 @patch("custom_components.tuya_local.config_flow.async_test_connection")
 async def test_options_flow_modifies_config(mock_test, hass):
     mock_device = MagicMock()
@@ -528,6 +542,7 @@ async def test_options_flow_modifies_config(mock_test, hass):
     assert expected == result["data"]
 
 
+@pytest.mark.asyncio
 @patch("custom_components.tuya_local.config_flow.async_test_connection")
 async def test_options_flow_fails_when_connection_fails(mock_test, hass):
     mock_test.return_value = None
@@ -564,6 +579,7 @@ async def test_options_flow_fails_when_connection_fails(mock_test, hass):
     assert {"base": "connection"} == result["errors"]
 
 
+@pytest.mark.asyncio
 @patch("custom_components.tuya_local.config_flow.async_test_connection")
 async def test_options_flow_fails_when_config_is_missing(mock_test, hass):
     mock_device = MagicMock()
@@ -592,6 +608,7 @@ async def test_options_flow_fails_when_config_is_missing(mock_test, hass):
     assert result["reason"] == "not_supported"
 
 
+@pytest.mark.asyncio
 @patch("custom_components.tuya_local.setup_device")
 async def test_async_setup_entry_for_switch(mock_device, hass):
     """Test setting up based on a config entry.  Repeats test_init_entry."""

+ 4 - 0
tests/test_cover.py

@@ -1,5 +1,6 @@
 """Tests for the cover entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.cover import TuyaLocalCover
 from custom_components.tuya_local.cover import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -35,6 +37,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_cover(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -61,6 +64,7 @@ async def test_init_entry_fails_if_device_has_no_cover(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(

+ 1 - 1
tests/test_device_config.py

@@ -1,5 +1,5 @@
 """Test the config parser"""
-from unittest import IsolatedAsyncioTestCase, TestCase
+from unittest import IsolatedAsyncioTestCase
 from unittest.mock import MagicMock
 
 from custom_components.tuya_local.helpers.device_config import (

+ 4 - 1
tests/test_diagnostics.py

@@ -1,6 +1,7 @@
 """Tests for diagnostics platform"""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
-from unittest.mock import AsyncMock, Mock
+import pytest
+from unittest.mock import AsyncMock
 
 from custom_components.tuya_local.const import (
     DOMAIN,
@@ -16,6 +17,7 @@ from custom_components.tuya_local.diagnostics import (
 )
 
 
+@pytest.mark.asyncio
 async def test_config_entry_diagnostics(hass):
     entry = MockConfigEntry(
         domain=DOMAIN,
@@ -32,6 +34,7 @@ async def test_config_entry_diagnostics(hass):
     assert diag
 
 
+@pytest.mark.asyncio
 async def test_device_diagnostics(hass):
     entry = MockConfigEntry(
         domain=DOMAIN,

+ 5 - 0
tests/test_fan.py

@@ -1,5 +1,6 @@
 """Tests for the fan entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.fan import TuyaLocalFan
 from custom_components.tuya_local.fan import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -37,6 +39,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_as_secondary(hass):
     """Test initialisation when fan is a secondary entity"""
     entry = MockConfigEntry(
@@ -62,6 +65,7 @@ async def test_init_entry_as_secondary(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_fan(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -89,6 +93,7 @@ async def test_init_entry_fails_if_device_has_no_fan(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(

+ 4 - 0
tests/test_humidifier.py

@@ -1,5 +1,6 @@
 """Tests for the humidifier entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.humidifier import TuyaLocalHumidifier
 from custom_components.tuya_local.humidifier import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -37,6 +39,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_humidifier(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -64,6 +67,7 @@ async def test_init_entry_fails_if_device_has_no_humidifier(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(

+ 4 - 0
tests/test_light.py

@@ -1,5 +1,6 @@
 """Tests for the light entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.light import TuyaLocalLight
 from custom_components.tuya_local.light import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -37,6 +39,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_light(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -64,6 +67,7 @@ async def test_init_entry_fails_if_device_has_no_light(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(

+ 4 - 0
tests/test_lock.py

@@ -1,5 +1,6 @@
 """Tests for the lock entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.lock import TuyaLocalLock
 from custom_components.tuya_local.lock import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -37,6 +39,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_lock(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -64,6 +67,7 @@ async def test_init_entry_fails_if_device_has_no_lock(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(

+ 4 - 0
tests/test_number.py

@@ -1,5 +1,6 @@
 """Tests for the number entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.number import TuyaLocalNumber
 from custom_components.tuya_local.number import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -34,6 +36,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_number(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -58,6 +61,7 @@ async def test_init_entry_fails_if_device_has_no_number(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(

+ 4 - 0
tests/test_select.py

@@ -1,5 +1,6 @@
 """Tests for the select entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.select import TuyaLocalSelect
 from custom_components.tuya_local.select import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -34,6 +36,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_select(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -58,6 +61,7 @@ async def test_init_entry_fails_if_device_has_no_select(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(

+ 4 - 0
tests/test_sensor.py

@@ -1,5 +1,6 @@
 """Tests for the sensor entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.sensor import TuyaLocalSensor
 from custom_components.tuya_local.sensor import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -37,6 +39,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_sensor(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -61,6 +64,7 @@ async def test_init_entry_fails_if_device_has_no_sensor(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(

+ 4 - 0
tests/test_siren.py

@@ -1,5 +1,6 @@
 """Tests for the siren entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.siren import TuyaLocalSiren
 from custom_components.tuya_local.siren import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test initialisation"""
     entry = MockConfigEntry(
@@ -32,6 +34,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_siren(hass):
     """Test initialisation when device as no matching entity"""
     entry = MockConfigEntry(
@@ -54,6 +57,7 @@ async def test_init_entry_fails_if_device_has_no_siren(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when config does not exist"""
     entry = MockConfigEntry(

+ 5 - 0
tests/test_switch.py

@@ -1,5 +1,6 @@
 """Tests for the switch entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.switch import TuyaLocalSwitch
 from custom_components.tuya_local.switch import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -37,6 +39,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_as_secondary(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -62,6 +65,7 @@ async def test_init_entry_as_secondary(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_switch(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -89,6 +93,7 @@ async def test_init_entry_fails_if_device_has_no_switch(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(

+ 4 - 0
tests/test_vacuum.py

@@ -1,5 +1,6 @@
 """Tests for the vacuum entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 from custom_components.tuya_local.const import (
     CONF_DEVICE_ID,
@@ -11,6 +12,7 @@ from custom_components.tuya_local.generic.vacuum import TuyaLocalVacuum
 from custom_components.tuya_local.vacuum import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -35,6 +37,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_vacuum(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -61,6 +64,7 @@ async def test_init_entry_fails_if_device_has_no_vacuum(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(

+ 4 - 0
tests/test_water_heater.py

@@ -1,5 +1,6 @@
 """Tests for the water heater entity."""
 from pytest_homeassistant_custom_component.common import MockConfigEntry
+import pytest
 from unittest.mock import AsyncMock, Mock
 
 from custom_components.tuya_local.const import (
@@ -12,6 +13,7 @@ from custom_components.tuya_local.generic.water_heater import TuyaLocalWaterHeat
 from custom_components.tuya_local.water_heater import async_setup_entry
 
 
+@pytest.mark.asyncio
 async def test_init_entry(hass):
     """Test the initialisation."""
     entry = MockConfigEntry(
@@ -37,6 +39,7 @@ async def test_init_entry(hass):
     m_add_entities.assert_called_once()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_device_has_no_water_heater(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(
@@ -64,6 +67,7 @@ async def test_init_entry_fails_if_device_has_no_water_heater(hass):
     m_add_entities.assert_not_called()
 
 
+@pytest.mark.asyncio
 async def test_init_entry_fails_if_config_is_missing(hass):
     """Test initialisation when device has no matching entity"""
     entry = MockConfigEntry(