mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Load fixture with decorator to avoid variable not accessed error (#118954)
Use fixture decorator
This commit is contained in:
parent
f425420899
commit
6e8d6f5994
@ -12,9 +12,8 @@ from homeassistant.core import HomeAssistant
|
|||||||
from homeassistant.data_entry_flow import FlowResultType
|
from homeassistant.data_entry_flow import FlowResultType
|
||||||
|
|
||||||
|
|
||||||
async def test_form(
|
@pytest.mark.usefixtures("mock_ista")
|
||||||
hass: HomeAssistant, mock_setup_entry: AsyncMock, mock_ista: MagicMock
|
async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None:
|
||||||
) -> None:
|
|
||||||
"""Test we get the form."""
|
"""Test we get the form."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": SOURCE_USER}
|
DOMAIN, context={"source": SOURCE_USER}
|
||||||
|
@ -19,8 +19,9 @@ from homeassistant.helpers import device_registry as dr
|
|||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("mock_ista")
|
||||||
async def test_entry_setup_unload(
|
async def test_entry_setup_unload(
|
||||||
hass: HomeAssistant, ista_config_entry: MockConfigEntry, mock_ista: MagicMock
|
hass: HomeAssistant, ista_config_entry: MockConfigEntry
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test integration setup and unload."""
|
"""Test integration setup and unload."""
|
||||||
|
|
||||||
@ -79,10 +80,10 @@ async def test_config_entry_error(
|
|||||||
assert ista_config_entry.state is ConfigEntryState.SETUP_ERROR
|
assert ista_config_entry.state is ConfigEntryState.SETUP_ERROR
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("mock_ista")
|
||||||
async def test_device_registry(
|
async def test_device_registry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
ista_config_entry: MockConfigEntry,
|
ista_config_entry: MockConfigEntry,
|
||||||
mock_ista: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
snapshot: SnapshotAssertion,
|
snapshot: SnapshotAssertion,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
"""Tests for the ista EcoTrend Sensors."""
|
"""Tests for the ista EcoTrend Sensors."""
|
||||||
|
|
||||||
from unittest.mock import MagicMock
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from syrupy.assertion import SnapshotAssertion
|
from syrupy.assertion import SnapshotAssertion
|
||||||
|
|
||||||
@ -12,11 +10,10 @@ from homeassistant.helpers import entity_registry as er
|
|||||||
from tests.common import MockConfigEntry, snapshot_platform
|
from tests.common import MockConfigEntry, snapshot_platform
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
@pytest.mark.usefixtures("mock_ista", "entity_registry_enabled_by_default")
|
||||||
async def test_setup(
|
async def test_setup(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
ista_config_entry: MockConfigEntry,
|
ista_config_entry: MockConfigEntry,
|
||||||
mock_ista: MagicMock,
|
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
snapshot: SnapshotAssertion,
|
snapshot: SnapshotAssertion,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user