Add missing argument type to core tests (#119667)

pull/119673/head
epenet 2024-06-14 08:42:01 +02:00 committed by GitHub
parent f3ce562847
commit 9f41133bbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 23 additions and 17 deletions

View File

@ -743,7 +743,7 @@ async def hass_supervisor_user(
@pytest.fixture
async def hass_supervisor_access_token(
hass: HomeAssistant,
hass_supervisor_user,
hass_supervisor_user: MockUser,
local_auth: homeassistant.HassAuthProvider,
) -> str:
"""Return a Home Assistant Supervisor access token."""
@ -836,7 +836,7 @@ def current_request_with_host(current_request: MagicMock) -> None:
@pytest.fixture
def hass_ws_client(
aiohttp_client: ClientSessionGenerator,
hass_access_token: str | None,
hass_access_token: str,
hass: HomeAssistant,
socket_enabled: None,
) -> WebSocketGenerator:
@ -1372,7 +1372,7 @@ def hass_recorder(
enable_migrate_context_ids: bool,
enable_migrate_event_type_ids: bool,
enable_migrate_entity_ids: bool,
hass_storage,
hass_storage: dict[str, Any],
) -> Generator[Callable[..., HomeAssistant]]:
"""Home Assistant fixture with in-memory recorder."""
# pylint: disable-next=import-outside-toplevel

View File

@ -1601,7 +1601,7 @@ async def test_translation_key(hass: HomeAssistant) -> None:
assert mock_entity2.translation_key == "from_entity_description"
async def test_repr(hass) -> None:
async def test_repr(hass: HomeAssistant) -> None:
"""Test Entity.__repr__."""
class MyEntity(MockEntity):

View File

@ -32,9 +32,8 @@ async def test_get_integration_logger(
assert logger.name == "homeassistant.components.hue"
async def test_extract_frame_resolve_module(
hass: HomeAssistant, enable_custom_integrations
) -> None:
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_extract_frame_resolve_module(hass: HomeAssistant) -> None:
"""Test extracting the current frame from integration context."""
# pylint: disable-next=import-outside-toplevel
from custom_components.test_integration_frame import call_get_integration_frame
@ -50,9 +49,8 @@ async def test_extract_frame_resolve_module(
)
async def test_get_integration_logger_resolve_module(
hass: HomeAssistant, enable_custom_integrations
) -> None:
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_get_integration_logger_resolve_module(hass: HomeAssistant) -> None:
"""Test getting the logger from integration context."""
# pylint: disable-next=import-outside-toplevel
from custom_components.test_integration_frame import call_get_integration_logger

View File

@ -647,7 +647,9 @@ async def test_stage_shutdown_timeouts(hass: HomeAssistant) -> None:
assert hass.state is CoreState.stopped
async def test_stage_shutdown_generic_error(hass: HomeAssistant, caplog) -> None:
async def test_stage_shutdown_generic_error(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Simulate a shutdown, test that a generic error at the final stage doesn't prevent it."""
task = asyncio.Future()

View File

@ -556,7 +556,9 @@ async def test_show_progress_hidden_from_frontend(hass: HomeAssistant, manager)
assert async_show_progress_done_called
async def test_show_progress_legacy(hass: HomeAssistant, manager, caplog) -> None:
async def test_show_progress_legacy(
hass: HomeAssistant, manager, caplog: pytest.LogCaptureFixture
) -> None:
"""Test show progress logic.
This tests the deprecated version where the config flow is responsible for

View File

@ -1125,7 +1125,10 @@ CUSTOM_ISSUE_TRACKER = "https://blablabla.com"
],
)
async def test_async_get_issue_tracker(
hass, domain: str | None, module: str | None, issue_tracker: str | None
hass: HomeAssistant,
domain: str | None,
module: str | None,
issue_tracker: str | None,
) -> None:
"""Test async_get_issue_tracker."""
mock_integration(hass, MockModule("bla_built_in"))
@ -1187,7 +1190,7 @@ async def test_async_get_issue_tracker(
],
)
async def test_async_get_issue_tracker_no_hass(
hass, domain: str | None, module: str | None, issue_tracker: str
hass: HomeAssistant, domain: str | None, module: str | None, issue_tracker: str
) -> None:
"""Test async_get_issue_tracker."""
mock_integration(hass, MockModule("bla_built_in"))
@ -1220,7 +1223,7 @@ REPORT_CUSTOM_UNKNOWN = "report it to the custom integration author"
],
)
async def test_async_suggest_report_issue(
hass, domain: str | None, module: str | None, report_issue: str
hass: HomeAssistant, domain: str | None, module: str | None, report_issue: str
) -> None:
"""Test async_suggest_report_issue."""
mock_integration(hass, MockModule("bla_built_in"))
@ -1952,7 +1955,8 @@ async def test_integration_warnings(
assert "configured to to import its code in the event loop" in caplog.text
async def test_has_services(hass: HomeAssistant, enable_custom_integrations) -> None:
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_has_services(hass: HomeAssistant) -> None:
"""Test has_services."""
integration = await loader.async_get_integration(hass, "test")
assert integration.has_services is False

View File

@ -1057,7 +1057,7 @@ async def test_async_start_setup_simple_integration_end_to_end(
}
async def test_async_get_setup_timings(hass) -> None:
async def test_async_get_setup_timings(hass: HomeAssistant) -> None:
"""Test we can get the setup timings from the setup time data."""
setup_time = setup._setup_times(hass)
# Mock setup time data