File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -190,6 +190,18 @@ def test_generates_hex_string(self):
190190class 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" )
You can’t perform that action at this time.
0 commit comments