1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-22 13:12:22 +01:00
This commit is contained in:
J. Nick Koston
2025-09-21 10:15:22 -06:00
parent 2aa0ebd1d2
commit 69cad7b3c7

View File

@@ -9,7 +9,7 @@ import io
from pathlib import Path
import socket
import struct
from unittest.mock import MagicMock, Mock, call, patch
from unittest.mock import Mock, call, patch
import pytest
from pytest import CaptureFixture
@@ -86,15 +86,6 @@ def mock_run_ota_impl() -> Generator[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
def mock_socket_constructor(mock_socket: Mock) -> Generator[Mock]:
"""Mock socket.socket constructor to return our mock socket."""