Skip to content

Commit

Permalink
Add missing argument type to core tests (home-assistant#119667)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Jun 14, 2024
1 parent f3ce562 commit 9f41133
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 17 deletions.
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/test_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 4 additions & 6 deletions tests/helpers/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion tests/test_data_entry_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,9 @@ async def async_step_finish(self, user_input=None):
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
Expand Down
12 changes: 8 additions & 4 deletions tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,10 @@ async def test_loggers(hass: HomeAssistant) -> None:
],
)
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"))
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -1220,7 +1223,7 @@ async def test_async_get_issue_tracker_no_hass(
],
)
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"))
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9f41133

Please sign in to comment.