def test_subtest_fail(self): test_rec = yield htf.Test( add_set_diag, htf.Subtest( 'subtest', phase0, phase_branches.DiagnosisCheckpoint( 'diag_subtest_pass', phase_branches.DiagnosisCondition.on_all( BranchDiagResult.SET), action=htf.PhaseResult.FAIL_SUBTEST), skip0), phase1) self.assertTestFail(test_rec) self.assertPhasesOutcomeByName(test_record.PhaseOutcome.PASS, test_rec, 'add_set_diag', 'phase0', 'phase1') self.assertPhasesOutcomeByName(test_record.PhaseOutcome.SKIP, test_rec, 'skip0') self.assertEqual([ test_record.CheckpointRecord( name='diag_subtest_pass', action=htf.PhaseResult.FAIL_SUBTEST, conditional=phase_branches.DiagnosisCondition( phase_branches.ConditionOn.ALL, (BranchDiagResult.SET, )), subtest_name='subtest', result=phase_executor.PhaseExecutionOutcome( htf.PhaseResult.FAIL_SUBTEST), evaluated_millis=htf_test.VALID_TIMESTAMP), ], test_rec.checkpoints)
def test_fail(self): test_rec = yield htf.Test( add_set_diag, phase_branches.DiagnosisCheckpoint( 'diag_fail', phase_branches.DiagnosisCondition.on_all( BranchDiagResult.SET)), error_phase) self.assertTestFail(test_rec) self.assertPhasesOutcomeByName( test_record.PhaseOutcome.PASS, test_rec, 'add_set_diag', ) self.assertEqual([ test_record.CheckpointRecord( name='diag_fail', action=htf.PhaseResult.STOP, conditional=phase_branches.DiagnosisCondition( phase_branches.ConditionOn.ALL, (BranchDiagResult.SET, )), subtest_name=None, result=phase_executor.PhaseExecutionOutcome( htf.PhaseResult.STOP), evaluated_millis=htf_test.VALID_TIMESTAMP), ], test_rec.checkpoints)
def test_subtest_pass(self): test_rec = yield htf.Test( phase0, htf.Subtest( 'subtest', phase1, phase_branches.DiagnosisCheckpoint( 'diag_subtest_pass', phase_branches.DiagnosisCondition.on_all( BranchDiagResult.NOT_SET), action=htf.PhaseResult.FAIL_SUBTEST), phase2), phase3) self.assertTestPass(test_rec) self.assertPhasesOutcomeByName(test_record.PhaseOutcome.PASS, test_rec, 'phase0', 'phase1', 'phase2', 'phase1') self.assertEqual([ test_record.CheckpointRecord( name='diag_subtest_pass', action=htf.PhaseResult.FAIL_SUBTEST, conditional=phase_branches.DiagnosisCondition( phase_branches.ConditionOn.ALL, (BranchDiagResult.NOT_SET, )), subtest_name='subtest', result=phase_executor.PhaseExecutionOutcome( htf.PhaseResult.CONTINUE), evaluated_millis=htf_test.VALID_TIMESTAMP), ], test_rec.checkpoints)
def test_branch_not_taken(self): nodes = [ phase_branches.BranchSequence( phase_branches.DiagnosisCondition.on_all( BranchDiagResult.NOT_SET), run_phase), ] test_rec = yield htf.Test(nodes) self.assertTestPass(test_rec) self._assert_phase_names([], test_rec) self.assertEqual([ test_record.BranchRecord( name=None, diag_condition=phase_branches.DiagnosisCondition( condition=phase_branches.ConditionOn.ALL, diagnosis_results=(BranchDiagResult.NOT_SET, )), branch_taken=False, evaluated_millis=mock.ANY) ], test_rec.branches)