mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-12-02 13:43:25 +01:00
win32 test fixes
This commit is contained in:
parent
b67b238eb3
commit
bbc9390f91
@ -1,15 +1,16 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import socket
|
||||
from contextlib import suppress
|
||||
from datetime import timedelta
|
||||
from functools import partial
|
||||
import logging
|
||||
import socket
|
||||
from typing import Callable, cast
|
||||
from unittest.mock import AsyncMock, MagicMock, call, create_autospec, patch
|
||||
|
||||
import pytest
|
||||
from google.protobuf import message
|
||||
import pytest
|
||||
|
||||
from aioesphomeapi import APIClient
|
||||
from aioesphomeapi._frame_helper import APIPlaintextFrameHelper
|
||||
@ -59,7 +60,7 @@ KEEP_ALIVE_TIMEOUT_RATIO = 4.5
|
||||
async def test_connect(
|
||||
plaintext_connect_task_no_login: tuple[
|
||||
APIConnection, asyncio.Transport, APIPlaintextFrameHelper, asyncio.Task
|
||||
]
|
||||
],
|
||||
) -> None:
|
||||
"""Test that a plaintext connection works."""
|
||||
conn, transport, protocol, connect_task = plaintext_connect_task_no_login
|
||||
@ -268,7 +269,11 @@ async def test_start_connection_cannot_increase_recv_buffer(
|
||||
mock_socket.fileno.return_value = 1
|
||||
mock_socket.getpeername.return_value = ("10.0.0.512", 323)
|
||||
mock_socket.setsockopt = _setsockopt
|
||||
mock_socket.sendmsg.side_effect = OSError("Socket error")
|
||||
with suppress(AttributeError):
|
||||
mock_socket.sendmsg.side_effect = OSError("Socket error")
|
||||
mock_socket.send.side_effect = OSError("Socket error")
|
||||
mock_socket.sendto.side_effect = OSError("Socket error")
|
||||
|
||||
aiohappyeyeballs_start_connection.return_value = mock_socket
|
||||
|
||||
with patch.object(
|
||||
|
@ -1,15 +1,15 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import socket
|
||||
from ipaddress import IPv6Address, ip_address
|
||||
import socket
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from zeroconf.asyncio import AsyncServiceInfo, AsyncZeroconf
|
||||
|
||||
import aioesphomeapi.host_resolver as hr
|
||||
from aioesphomeapi.core import APIConnectionError, ResolveAPIError
|
||||
import aioesphomeapi.host_resolver as hr
|
||||
from aioesphomeapi.zeroconf import ZeroconfManager
|
||||
|
||||
|
||||
|
@ -5,12 +5,15 @@ from datetime import timedelta
|
||||
from functools import partial
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from google.protobuf import message
|
||||
import pytest
|
||||
|
||||
from aioesphomeapi._frame_helper.plain_text import APIPlaintextFrameHelper
|
||||
from aioesphomeapi.api_pb2 import SubscribeLogsResponse # type: ignore
|
||||
from aioesphomeapi.api_pb2 import DisconnectRequest, DisconnectResponse
|
||||
from aioesphomeapi.api_pb2 import (
|
||||
DisconnectRequest,
|
||||
DisconnectResponse,
|
||||
SubscribeLogsResponse, # type: ignore
|
||||
)
|
||||
from aioesphomeapi.client import APIClient
|
||||
from aioesphomeapi.connection import APIConnection
|
||||
from aioesphomeapi.core import APIConnectionError
|
||||
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
import pytest
|
||||
from google.protobuf import message
|
||||
import pytest
|
||||
|
||||
from aioesphomeapi.api_pb2 import (
|
||||
AlarmControlPanelStateResponse,
|
||||
@ -65,14 +65,10 @@ from aioesphomeapi.model import (
|
||||
APIVersion,
|
||||
BinarySensorInfo,
|
||||
BinarySensorState,
|
||||
)
|
||||
from aioesphomeapi.model import (
|
||||
BluetoothGATTCharacteristic as BluetoothGATTCharacteristicModel,
|
||||
)
|
||||
from aioesphomeapi.model import BluetoothGATTDescriptor as BluetoothGATTDescriptorModel
|
||||
from aioesphomeapi.model import BluetoothGATTService as BluetoothGATTServiceModel
|
||||
from aioesphomeapi.model import BluetoothGATTServices as BluetoothGATTServicesModel
|
||||
from aioesphomeapi.model import (
|
||||
BluetoothGATTDescriptor as BluetoothGATTDescriptorModel,
|
||||
BluetoothGATTService as BluetoothGATTServiceModel,
|
||||
BluetoothGATTServices as BluetoothGATTServicesModel,
|
||||
BluetoothProxyFeature,
|
||||
ButtonInfo,
|
||||
CameraInfo,
|
||||
|
Loading…
Reference in New Issue
Block a user