Load fixture with decorator to avoid variable not accessed error (#118954)

Use fixture decorator
This commit is contained in:
Mr. Bubbles 2024-06-06 12:15:13 +02:00 committed by GitHub
parent f425420899
commit 6e8d6f5994
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 9 deletions

View File

@ -12,9 +12,8 @@ from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultType
async def test_form(
hass: HomeAssistant, mock_setup_entry: AsyncMock, mock_ista: MagicMock
) -> None:
@pytest.mark.usefixtures("mock_ista")
async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None:
"""Test we get the form."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}

View File

@ -19,8 +19,9 @@ from homeassistant.helpers import device_registry as dr
from tests.common import MockConfigEntry
@pytest.mark.usefixtures("mock_ista")
async def test_entry_setup_unload(
hass: HomeAssistant, ista_config_entry: MockConfigEntry, mock_ista: MagicMock
hass: HomeAssistant, ista_config_entry: MockConfigEntry
) -> None:
"""Test integration setup and unload."""
@ -79,10 +80,10 @@ async def test_config_entry_error(
assert ista_config_entry.state is ConfigEntryState.SETUP_ERROR
@pytest.mark.usefixtures("mock_ista")
async def test_device_registry(
hass: HomeAssistant,
ista_config_entry: MockConfigEntry,
mock_ista: MagicMock,
device_registry: dr.DeviceRegistry,
snapshot: SnapshotAssertion,
) -> None:

View File

@ -1,7 +1,5 @@
"""Tests for the ista EcoTrend Sensors."""
from unittest.mock import MagicMock
import pytest
from syrupy.assertion import SnapshotAssertion
@ -12,11 +10,10 @@ from homeassistant.helpers import entity_registry as er
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(
hass: HomeAssistant,
ista_config_entry: MockConfigEntry,
mock_ista: MagicMock,
entity_registry: er.EntityRegistry,
snapshot: SnapshotAssertion,
) -> None: