Move fixtures to decorators in core tests (#119675)

This commit is contained in:
epenet 2024-06-14 13:32:42 +02:00 committed by GitHub
parent b80f7185b2
commit 01be5d5f6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 80 additions and 109 deletions

View file

@ -139,8 +139,8 @@ async def test_config_does_not_turn_off_debug(hass: HomeAssistant) -> None:
@pytest.mark.parametrize("hass_config", [{"frontend": {}}])
@pytest.mark.usefixtures("mock_hass_config")
async def test_asyncio_debug_on_turns_hass_debug_on(
mock_hass_config: None,
mock_enable_logging: Mock,
mock_is_virtual_env: Mock,
mock_mount_local_lib_path: AsyncMock,
@ -632,8 +632,8 @@ def mock_ensure_config_exists() -> Generator[AsyncMock]:
@pytest.mark.parametrize("hass_config", [{"browser": {}, "frontend": {}}])
@pytest.mark.usefixtures("mock_hass_config")
async def test_setup_hass(
mock_hass_config: None,
mock_enable_logging: Mock,
mock_is_virtual_env: Mock,
mock_mount_local_lib_path: AsyncMock,
@ -685,8 +685,8 @@ async def test_setup_hass(
@pytest.mark.parametrize("hass_config", [{"browser": {}, "frontend": {}}])
@pytest.mark.usefixtures("mock_hass_config")
async def test_setup_hass_takes_longer_than_log_slow_startup(
mock_hass_config: None,
mock_enable_logging: Mock,
mock_is_virtual_env: Mock,
mock_mount_local_lib_path: AsyncMock,
@ -815,8 +815,8 @@ async def test_setup_hass_recovery_mode(
assert len(browser_setup.mock_calls) == 0
@pytest.mark.usefixtures("mock_hass_config")
async def test_setup_hass_safe_mode(
mock_hass_config: None,
mock_enable_logging: Mock,
mock_is_virtual_env: Mock,
mock_mount_local_lib_path: AsyncMock,
@ -850,8 +850,8 @@ async def test_setup_hass_safe_mode(
assert "Starting in safe mode" in caplog.text
@pytest.mark.usefixtures("mock_hass_config")
async def test_setup_hass_recovery_mode_and_safe_mode(
mock_hass_config: None,
mock_enable_logging: Mock,
mock_is_virtual_env: Mock,
mock_mount_local_lib_path: AsyncMock,
@ -886,8 +886,8 @@ async def test_setup_hass_recovery_mode_and_safe_mode(
@pytest.mark.parametrize("hass_config", [{"homeassistant": {"non-existing": 1}}])
@pytest.mark.usefixtures("mock_hass_config")
async def test_setup_hass_invalid_core_config(
mock_hass_config: None,
mock_enable_logging: Mock,
mock_is_virtual_env: Mock,
mock_mount_local_lib_path: AsyncMock,
@ -925,8 +925,8 @@ async def test_setup_hass_invalid_core_config(
}
],
)
@pytest.mark.usefixtures("mock_hass_config")
async def test_setup_recovery_mode_if_no_frontend(
mock_hass_config: None,
mock_enable_logging: Mock,
mock_is_virtual_env: Mock,
mock_mount_local_lib_path: AsyncMock,
@ -1372,10 +1372,9 @@ async def test_bootstrap_does_not_preload_stage_1_integrations() -> None:
@pytest.mark.parametrize("load_registries", [False])
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_cancellation_does_not_leak_upward_from_async_setup(
hass: HomeAssistant,
caplog: pytest.LogCaptureFixture,
enable_custom_integrations: None,
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test setting up an integration that raises asyncio.CancelledError."""
await bootstrap.async_setup_multi_components(
@ -1390,10 +1389,9 @@ async def test_cancellation_does_not_leak_upward_from_async_setup(
@pytest.mark.parametrize("load_registries", [False])
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_cancellation_does_not_leak_upward_from_async_setup_entry(
hass: HomeAssistant,
caplog: pytest.LogCaptureFixture,
enable_custom_integrations: None,
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test setting up an integration that raises asyncio.CancelledError."""
entry = MockConfigEntry(