1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Bump ruff to 0.3.4 (#112690)

Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Joost Lekkerkerker
2024-03-26 00:02:16 +01:00
committed by GitHub
parent 27219b6962
commit 6bb4e7d62c
1044 changed files with 24245 additions and 16750 deletions

View File

@@ -55,13 +55,15 @@ def mock_client_key_check_fail() -> Generator[MagicMock, None, None]:
@pytest.fixture
def mock_ssl_context() -> Generator[dict[str, MagicMock], None, None]:
"""Mock the SSL context used to load the cert chain and to load verify locations."""
with patch(
"homeassistant.components.mqtt.config_flow.SSLContext"
) as mock_context, patch(
"homeassistant.components.mqtt.config_flow.load_pem_private_key"
) as mock_key_check, patch(
"homeassistant.components.mqtt.config_flow.load_pem_x509_certificate"
) as mock_cert_check:
with (
patch("homeassistant.components.mqtt.config_flow.SSLContext") as mock_context,
patch(
"homeassistant.components.mqtt.config_flow.load_pem_private_key"
) as mock_key_check,
patch(
"homeassistant.components.mqtt.config_flow.load_pem_x509_certificate"
) as mock_cert_check,
):
yield {
"context": mock_context,
"load_pem_x509_certificate": mock_cert_check,
@@ -123,8 +125,9 @@ def mock_try_connection_time_out() -> Generator[MagicMock, None, None]:
"""Mock the try connection method with a time out."""
# Patch prevent waiting 5 sec for a timeout
with patch("paho.mqtt.client.Client") as mock_client, patch(
"homeassistant.components.mqtt.config_flow.MQTT_TIMEOUT", 0
with (
patch("paho.mqtt.client.Client") as mock_client,
patch("homeassistant.components.mqtt.config_flow.MQTT_TIMEOUT", 0),
):
mock_client().loop_start = lambda *args: 1
yield mock_client()