55from math import isnan
66import struct
77from unittest import TestCase
8- from unittest .mock import Mock , Mock
8+ from unittest .mock import Mock
99from unittest .mock import patch
1010from unittest .mock import call
1111
@@ -151,7 +151,6 @@ def setUp(self):
151151 mock_transport_scpi = Mock (spec = QMI_Transport )
152152 transport_scpi_str = "scpi:roosh:kangaroo"
153153 self .mock_scpi = Mock (spec = ScpiProtocol )
154- self .mock_reader = Mock (spec = _ReaderThread )
155154 self .mock_queue = Mock ()
156155
157156 def se_create_transport (transport ):
@@ -161,10 +160,9 @@ def se_create_transport(transport):
161160 return mock_transport_serial
162161
163162 with patch (
164- "qmi.instruments.bristol.bristol_871a.create_transport" , side_effect = se_create_transport ,
163+ "qmi.instruments.bristol.bristol_871a.create_transport" , se_create_transport ,
165164 ), patch ("qmi.instruments.bristol.bristol_871a.ScpiProtocol" , self .mock_scpi
166- ), patch ("qmi.instruments.bristol.bristol_871a._ReaderThread" , self .mock_reader
167- ), patch ("qmi.instruments.bristol.bristol_871a.collections.deque" , self .mock_queue
165+ ), patch ("qmi.instruments.bristol.bristol_871a.deque" , self .mock_queue
168166 ):
169167 self .instr = Bristol_871A (
170168 QMI_Context ("bristol_871_test_ctx" ),
@@ -179,8 +177,6 @@ def test_init_scpi(self):
179177 self .assertEqual (self .instr ._serial_transport , self .instr ._serial_transport )
180178 self .mock_scpi .assert_called_once_with (self .instr ._scpi_transport )
181179 self .assertEqual (self .instr ._scpi_protocol , self .instr ._scpi_protocol )
182- self .mock_reader .assert_called_once_with (self .instr ._serial_transport , self .instr ._reader_queue )
183- self .instr ._reader_thread .start .assert_called_once_with ()
184180
185181 def test_init_value_error (self ):
186182 """Bristol_871A.__init__(), value error handling"""
@@ -229,8 +225,6 @@ def test_close(self):
229225
230226 self .instr .close ()
231227 self .instr ._check_is_open .assert_has_calls ([call (), call ()]) # Once in close and once in super().close
232- self .instr ._reader_thread .shutdown .assert_called_once_with ()
233- self .instr ._reader_thread .join .assert_called_once_with ()
234228 self .instr ._serial_transport .close .assert_called_once_with ()
235229 self .instr ._scpi_transport .close .assert_called_once_with ()
236230
0 commit comments