Skip to content

Commit 1ac1615

Browse files
committed
Fix
1 parent b4588d3 commit 1ac1615

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/unit/test_communicator.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,18 @@ def test_generates_hex_string(self):
190190
class TestProtobufCommunicatorConnectSync:
191191
"""Tests for connect_sync method."""
192192

193+
@pytest.fixture(autouse=True)
194+
def _disable_background_reader(self, mocker):
195+
"""
196+
`connect_sync()` starts a background reader thread on successful handshake.
197+
198+
In unit tests we don't want real background threads running because they can:
199+
- block forever on mocked sockets
200+
- spin if mocks raise (e.g. StopIteration from side_effect exhaustion)
201+
- slow down / flake CI
202+
"""
203+
mocker.patch.object(ProtobufCommunicator, "_start_background_reader", autospec=True)
204+
193205
def test_connects_via_unix_socket(self, mocker):
194206
"""Should connect via Unix socket."""
195207
mock_socket_class = mocker.patch("socket.socket")

0 commit comments

Comments
 (0)