mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Add type hints for pytest.LogCaptureFixture in test fixtures (#118687)
This commit is contained in:
parent
bb259b607f
commit
9a5706fa30
@ -21,7 +21,7 @@ query_icon_matching = [
|
||||
|
||||
|
||||
@pytest.fixture(name="tvliftbox")
|
||||
def tv_lift_box_fixture(caplog):
|
||||
def tv_lift_box_fixture(caplog: pytest.LogCaptureFixture):
|
||||
"""Return simple button entity mock."""
|
||||
caplog.set_level(logging.ERROR)
|
||||
|
||||
|
@ -117,7 +117,12 @@ def mock_pymodbus_fixture(do_exception, register_words):
|
||||
|
||||
@pytest.fixture(name="mock_modbus")
|
||||
async def mock_modbus_fixture(
|
||||
hass, caplog, check_config_loaded, config_addon, do_config, mock_pymodbus
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
check_config_loaded,
|
||||
config_addon,
|
||||
do_config,
|
||||
mock_pymodbus,
|
||||
):
|
||||
"""Load integration modbus using mocked pymodbus."""
|
||||
conf = copy.deepcopy(do_config)
|
||||
@ -192,6 +197,6 @@ async def mock_modbus_ha_fixture(hass, mock_modbus):
|
||||
|
||||
|
||||
@pytest.fixture(name="caplog_setup_text")
|
||||
async def caplog_setup_text_fixture(caplog):
|
||||
async def caplog_setup_text_fixture(caplog: pytest.LogCaptureFixture) -> str:
|
||||
"""Return setup log of integration."""
|
||||
return caplog.text
|
||||
|
@ -136,7 +136,9 @@ from tests.common import async_fire_time_changed, get_fixture_path
|
||||
|
||||
|
||||
@pytest.fixture(name="mock_modbus_with_pymodbus")
|
||||
async def mock_modbus_with_pymodbus_fixture(hass, caplog, do_config, mock_pymodbus):
|
||||
async def mock_modbus_with_pymodbus_fixture(
|
||||
hass: HomeAssistant, caplog: pytest.LogCaptureFixture, do_config, mock_pymodbus
|
||||
):
|
||||
"""Load integration modbus using mocked pymodbus."""
|
||||
caplog.clear()
|
||||
caplog.set_level(logging.ERROR)
|
||||
@ -1361,12 +1363,12 @@ async def test_pb_service_write(
|
||||
|
||||
@pytest.fixture(name="mock_modbus_read_pymodbus")
|
||||
async def mock_modbus_read_pymodbus_fixture(
|
||||
hass,
|
||||
hass: HomeAssistant,
|
||||
do_group,
|
||||
do_type,
|
||||
do_scan_interval,
|
||||
do_return,
|
||||
caplog,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
mock_pymodbus,
|
||||
freezer: FrozenDateTimeFactory,
|
||||
):
|
||||
|
Loading…
x
Reference in New Issue
Block a user