Skip to content

Commit

Permalink
fix: switch to async_forward_entry_setup (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 authored Jan 28, 2023
1 parent 85e94d4 commit c7ce04e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/openei/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
raise ConfigEntryNotReady

hass.data[DOMAIN][entry.entry_id] = coordinator
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
for platform in PLATFORMS:
hass.async_add_job(
hass.config_entries.async_forward_entry_setup(entry, platform)
)

return True

Expand Down
2 changes: 2 additions & 0 deletions tests/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from custom_components.openei.const import DOMAIN

pytestmark = pytest.mark.asyncio


@pytest.mark.parametrize(
"input_1,step_id_2,input_2,step_id_3,input_3,title,data",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from custom_components.openei.const import DOMAIN
from tests.const import CONFIG_DATA, CONFIG_DATA_MISSING_PLAN, CONFIG_DATA_WITH_SENSOR

pytestmark = pytest.mark.asyncio

async def test_setup_entry(hass, mock_sensors, mock_api):
"""Test settting up entities."""
entry = MockConfigEntry(
Expand Down
3 changes: 3 additions & 0 deletions tests/test_sensors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for sensors."""
import pytest

from pytest_homeassistant_custom_component.common import MockConfigEntry

Expand All @@ -8,6 +9,8 @@
FAKE_MINCHARGE_SENSOR = "sensor.fake_utility_co_minimum_charge"
FAKE_CURRENT_RATE_SENSOR = "sensor.fake_utility_co_current_energy_rate"

pytestmark = pytest.mark.asyncio


async def test_sensors(hass, mock_sensors, mock_api):
"""Test settting up entities."""
Expand Down

0 comments on commit c7ce04e

Please sign in to comment.