Add type hints to integration tests (recorder) (#88313)

This commit is contained in:
epenet 2023-02-17 18:50:09 +01:00 committed by GitHub
parent 0a80ac19bc
commit 185cd61cbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 633 additions and 341 deletions

View file

@ -1,16 +1,15 @@
"""Test backup platform for the Recorder integration."""
from unittest.mock import patch
import pytest
from homeassistant.components.recorder import Recorder
from homeassistant.components.recorder.backup import async_post_backup, async_pre_backup
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
async def test_async_pre_backup(recorder_mock, hass: HomeAssistant) -> None:
async def test_async_pre_backup(recorder_mock: Recorder, hass: HomeAssistant) -> None:
"""Test pre backup."""
with patch(
"homeassistant.components.recorder.core.Recorder.lock_database"
@ -20,7 +19,7 @@ async def test_async_pre_backup(recorder_mock, hass: HomeAssistant) -> None:
async def test_async_pre_backup_with_timeout(
recorder_mock, hass: HomeAssistant
recorder_mock: Recorder, hass: HomeAssistant
) -> None:
"""Test pre backup with timeout."""
with patch(
@ -32,7 +31,7 @@ async def test_async_pre_backup_with_timeout(
async def test_async_pre_backup_with_migration(
recorder_mock, hass: HomeAssistant
recorder_mock: Recorder, hass: HomeAssistant
) -> None:
"""Test pre backup with migration."""
with patch(
@ -42,7 +41,7 @@ async def test_async_pre_backup_with_migration(
await async_pre_backup(hass)
async def test_async_post_backup(recorder_mock, hass: HomeAssistant) -> None:
async def test_async_post_backup(recorder_mock: Recorder, hass: HomeAssistant) -> None:
"""Test post backup."""
with patch(
"homeassistant.components.recorder.core.Recorder.unlock_database"
@ -51,7 +50,9 @@ async def test_async_post_backup(recorder_mock, hass: HomeAssistant) -> None:
assert unlock_mock.called
async def test_async_post_backup_failure(recorder_mock, hass: HomeAssistant) -> None:
async def test_async_post_backup_failure(
recorder_mock: Recorder, hass: HomeAssistant
) -> None:
"""Test post backup failure."""
with patch(
"homeassistant.components.recorder.core.Recorder.unlock_database",