def setUp(self): self.test_state = mock.MagicMock(spec=TestState, plug_manager=plugs.PlugManager(), logger=mock.MagicMock()) self.test_state.plug_manager.initialize_plugs([ UnittestPlug, MoreRepeatsUnittestPlug]) self.phase_executor = PhaseExecutor(self.test_state)
class TestPhaseExecutor(unittest.TestCase): def setUp(self): self.test_state = mock.MagicMock(spec=TestState, plug_manager=plugs.PlugManager(), logger=mock.MagicMock()) self.test_state.plug_manager.initialize_plugs([ UnittestPlug, MoreRepeatsUnittestPlug]) self.phase_executor = PhaseExecutor(self.test_state) def test_execute_continue_phase(self): result = self.phase_executor.execute_phase(phase_two) self.assertEqual(PhaseResult.CONTINUE, result.phase_result) def test_execute_repeat_okay_phase(self): result = self.phase_executor.execute_phase( phase_repeat.with_plugs(test_plug=UnittestPlug)) self.assertEqual(PhaseResult.CONTINUE, result.phase_result) def test_execute_repeat_limited_phase(self): result = self.phase_executor.execute_phase( phase_repeat.with_plugs(test_plug=MoreRepeatsUnittestPlug)) self.assertEqual(PhaseResult.STOP, result.phase_result) def test_execute_run_if_false(self): result = self.phase_executor.execute_phase(phase_skip_from_run_if) self.assertEqual(PhaseResult.SKIP, result.phase_result) def test_execute_phase_return_skip(self): result = self.phase_executor.execute_phase(phase_return_skip) self.assertEqual(PhaseResult.SKIP, result.phase_result)
def setUp(self): self.test_state = mock.MagicMock( spec=TestState, plug_manager=plugs.PlugManager( logger_name='mock.logger.for.openhtf'), execution_uid='01234567890') self.test_state.plug_manager.initialize_plugs( [UnittestPlug, MoreRepeatsUnittestPlug]) self.phase_executor = PhaseExecutor(self.test_state)
def setUp(self): self.test_state = mock.MagicMock( spec=TestState, plug_manager=plugs.PlugManager(logger_name='mock.logger.for.openhtf'), execution_uid='01234567890') self.test_state.plug_manager.initialize_plugs([ UnittestPlug, MoreRepeatsUnittestPlug]) self.phase_executor = PhaseExecutor(self.test_state)
class TestPhaseExecutor(unittest.TestCase): def setUp(self): self.test_state = mock.MagicMock(spec=TestState, plug_manager=plugs.PlugManager(), logger=mock.MagicMock()) self.test_state.plug_manager.initialize_plugs([UnittestPlug]) self.phase_executor = PhaseExecutor(self.test_state) def test_execute_phases(self): results = [ self.phase_executor.execute_phase(phase_two), self.phase_executor.execute_phase(phase_repeat), self.phase_executor.execute_phase(phase_skip), ] counter = self.test_state.plug_manager.provide_plugs( {'plug': UnittestPlug}.iteritems())['plug'] self.assertEqual(counter.count, 4) self.assertEqual(3, len(results)) self.assertEqual(PhaseResult.CONTINUE, results[0].phase_result) self.assertEqual(PhaseResult.REPEAT, results[1].phase_result) self.assertEqual(PhaseResult.CONTINUE, results[2].phase_result)
class TestPhaseExecutor(unittest.TestCase): def setUp(self): self.test_state = mock.MagicMock(spec=TestState, plug_manager=plugs.PlugManager(), logger=mock.MagicMock()) self.test_state.plug_manager.initialize_plugs([UnittestPlug]) self.phase_executor = PhaseExecutor(self.test_state) def test_execute_phases(self): results = list(self.phase_executor.execute_phases( [phase_two, phase_repeat], None)) self.assertEqual(5, len(results)) self.assertEqual(PhaseResult.CONTINUE, results[0].phase_result) for i in xrange(1, 5): self.assertEqual(PhaseResult.REPEAT, results[i].phase_result)
class TestPhaseExecutor(unittest.TestCase): def setUp(self): self.test_state = mock.MagicMock(spec=TestState, plug_manager=plugs.PlugManager(), logger=mock.MagicMock()) self.test_state.plug_manager.initialize_plugs([UnittestPlug]) self.phase_executor = PhaseExecutor(self.test_state) def test_execute_phases(self): results = list( self.phase_executor.execute_phases([phase_two, phase_repeat], None)) self.assertEqual(5, len(results)) self.assertEqual(PhaseResult.CONTINUE, results[0].phase_result) for i in xrange(1, 5): self.assertEqual(PhaseResult.REPEAT, results[i].phase_result)
class TestPhaseExecutor(unittest.TestCase): def setUp(self): self.test_state = mock.MagicMock( spec=TestState, plug_manager=plugs.PlugManager( logger_name='mock.logger.for.openhtf'), execution_uid='01234567890') self.test_state.plug_manager.initialize_plugs( [UnittestPlug, MoreRepeatsUnittestPlug]) self.phase_executor = PhaseExecutor(self.test_state) def test_execute_continue_phase(self): result = self.phase_executor.execute_phase(phase_two) self.assertEqual(PhaseResult.CONTINUE, result.phase_result) def test_execute_repeat_okay_phase(self): result = self.phase_executor.execute_phase( phase_repeat.with_plugs(test_plug=UnittestPlug)) self.assertEqual(PhaseResult.CONTINUE, result.phase_result) def test_execute_repeat_limited_phase(self): result = self.phase_executor.execute_phase( phase_repeat.with_plugs(test_plug=MoreRepeatsUnittestPlug)) self.assertEqual(PhaseResult.STOP, result.phase_result) def test_execute_run_if_false(self): result = self.phase_executor.execute_phase(phase_skip_from_run_if) self.assertEqual(PhaseResult.SKIP, result.phase_result) def test_execute_phase_return_skip(self): result = self.phase_executor.execute_phase(phase_return_skip) self.assertEqual(PhaseResult.SKIP, result.phase_result) def test_execute_phase_return_fail_and_continue(self): result = self.phase_executor.execute_phase( phase_return_fail_and_continue) self.assertEqual(PhaseResult.FAIL_AND_CONTINUE, result.phase_result)
class TestPhaseExecutor(unittest.TestCase): def setUp(self): self.test_state = mock.MagicMock( spec=TestState, plug_manager=plugs.PlugManager(logger_name='mock.logger.for.openhtf'), execution_uid='01234567890') self.test_state.plug_manager.initialize_plugs([ UnittestPlug, MoreRepeatsUnittestPlug]) self.phase_executor = PhaseExecutor(self.test_state) def test_execute_continue_phase(self): result = self.phase_executor.execute_phase(phase_two) self.assertEqual(PhaseResult.CONTINUE, result.phase_result) def test_execute_repeat_okay_phase(self): result = self.phase_executor.execute_phase( phase_repeat.with_plugs(test_plug=UnittestPlug)) self.assertEqual(PhaseResult.CONTINUE, result.phase_result) def test_execute_repeat_limited_phase(self): result = self.phase_executor.execute_phase( phase_repeat.with_plugs(test_plug=MoreRepeatsUnittestPlug)) self.assertEqual(PhaseResult.STOP, result.phase_result) def test_execute_run_if_false(self): result = self.phase_executor.execute_phase(phase_skip_from_run_if) self.assertEqual(PhaseResult.SKIP, result.phase_result) def test_execute_phase_return_skip(self): result = self.phase_executor.execute_phase(phase_return_skip) self.assertEqual(PhaseResult.SKIP, result.phase_result) def test_execute_phase_return_fail_and_continue(self): result = self.phase_executor.execute_phase(phase_return_fail_and_continue) self.assertEqual(PhaseResult.FAIL_AND_CONTINUE, result.phase_result)
def setUp(self): self.test_state = mock.MagicMock(spec=TestState, plug_manager=plugs.PlugManager(), logger=mock.MagicMock()) self.test_state.plug_manager.initialize_plugs([UnittestPlug]) self.phase_executor = PhaseExecutor(self.test_state)