mirror of
https://github.com/esphome/esphome.git
synced 2025-09-22 13:12:22 +01:00
preen
This commit is contained in:
@@ -9,7 +9,7 @@ import io
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
from unittest.mock import MagicMock, Mock, call, patch
|
from unittest.mock import Mock, call, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from pytest import CaptureFixture
|
from pytest import CaptureFixture
|
||||||
@@ -86,15 +86,6 @@ def mock_run_ota_impl() -> Generator[Mock]:
|
|||||||
yield mock
|
yield mock
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def mock_open_file() -> Generator[tuple[Mock, MagicMock]]:
|
|
||||||
"""Mock file opening for testing."""
|
|
||||||
with patch("builtins.open", create=True) as mock_open:
|
|
||||||
mock_file = MagicMock()
|
|
||||||
mock_open.return_value.__enter__.return_value = mock_file
|
|
||||||
yield mock_open, mock_file
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_socket_constructor(mock_socket: Mock) -> Generator[Mock]:
|
def mock_socket_constructor(mock_socket: Mock) -> Generator[Mock]:
|
||||||
"""Mock socket.socket constructor to return our mock socket."""
|
"""Mock socket.socket constructor to return our mock socket."""
|
||||||
|
Reference in New Issue
Block a user