def test_executionready_wait_skip(self, mock_log): # pylint: disable=unused-argument dut = Dut("test_dut") with mock.patch.object(dut, "response_received") as mock_r: mock_r.wait = mock.MagicMock() mock_r.wait.return_value = False dut.query_timeout = 0 dut.response_coming_in = -1 with self.assertRaises(TestStepError): dut._wait_for_exec_ready() # pylint: disable=protected-access mock_r.wait.return_value = True dut.query_timeout = 1 with self.assertRaises(TestStepError): dut._wait_for_exec_ready() # pylint: disable=protected-access
def test_wait_for_exec_ready(self, mock_log): dut_obj = Dut("test") dut_obj.get_time = mock.MagicMock(return_value=10) dut_obj.query_timeout = 9 mocked_response = mock.MagicMock() type(dut_obj).response_received = mock.PropertyMock(return_value=mocked_response) mocked_response.wait = mock.MagicMock(return_value=False) with self.assertRaises(TestStepTimeout): dut_obj._wait_for_exec_ready()