Beispiel #1
0
    def phase_statuses_dump(self, prefix='', skip_passes=False, skip_phase_list=None, xfails=None):
        """
        Args:
            prefix: string printed at the start of each line
            skip_passes: if True, do not output lines that have a PASS status
            skip_phase_list: list of phases (from the phases given by
                ALL_PHASES) for which we skip output
            xfails: object of type ExpectedFails, giving expected failures for this test
        """
        if skip_phase_list is None:
            skip_phase_list = []
        if xfails is None:
            xfails = expected_fails.ExpectedFails()
        result = ""
        if self._phase_statuses:
            for phase, data in self._phase_statuses.items():
                if phase in skip_phase_list:
                    continue
                status, comments = data
                xfail_comment = xfails.expected_fails_comment(phase, status)
                if skip_passes:
                    if status == TEST_PASS_STATUS and not xfail_comment:
                        # Note that we still print the result of a PASSing test if there
                        # is a comment related to the expected failure status. Typically
                        # this will indicate that this is an unexpected PASS (and so
                        # should be removed from the expected fails list).
                        continue
                result += "{}{} {} {}".format(prefix, status, self._test_name, phase)
                if comments:
                    result += " {}".format(comments)
                if xfail_comment:
                    result += " {}".format(xfail_comment)
                result += "\n"

        return result
Beispiel #2
0
 def test_psdump_oneCorePhasePassesInXFails(self):
     """One phase passes despite being in the expected fails list."""
     xfail_phase = test_status.CORE_PHASES[-1]
     xfails = expected_fails.ExpectedFails()
     xfails.add_failure(phase=xfail_phase,
                        expected_status=test_status.TEST_FAIL_STATUS)
     output = self._ts.phase_statuses_dump(xfails=xfails)
     self.assert_status_of_phase(output,
                                 test_status.TEST_PASS_STATUS,
                                 xfail_phase,
                                 self._TESTNAME,
                                 xfail='unexpected')
     self.assert_num_expected_unexpected_fails(output,
                                               num_expected=0,
                                               num_unexpected=1)
Beispiel #3
0
 def test_psdump_oneCorePhaseFailsInXFails(self):
     """One phase fails. That phase is in the expected fails list."""
     fail_phase = self._set_last_core_phase_to_fail()
     xfails = expected_fails.ExpectedFails()
     xfails.add_failure(phase=fail_phase,
                        expected_status=test_status.TEST_FAIL_STATUS)
     output = self._ts.phase_statuses_dump(xfails=xfails)
     self.assert_status_of_phase(output,
                                 test_status.TEST_FAIL_STATUS,
                                 fail_phase,
                                 self._TESTNAME,
                                 xfail='expected')
     self.assert_num_expected_unexpected_fails(output,
                                               num_expected=1,
                                               num_unexpected=0)
Beispiel #4
0
 def test_psdump_oneCorePhaseFailsAbsentFromXFails(self):
     """One phase fails. There is an expected fails list, but that phase is not in it."""
     fail_phase = self._set_last_core_phase_to_fail()
     xfails = expected_fails.ExpectedFails()
     xfails.add_failure(phase=self._NON_CORE_PHASE,
                        expected_status=test_status.TEST_FAIL_STATUS)
     output = self._ts.phase_statuses_dump(xfails=xfails)
     self.assert_status_of_phase(output,
                                 test_status.TEST_FAIL_STATUS,
                                 fail_phase,
                                 self._TESTNAME,
                                 xfail='no')
     self.assert_num_expected_unexpected_fails(output,
                                               num_expected=0,
                                               num_unexpected=0)
Beispiel #5
0
 def test_psdump_unexpectedPass_shouldBePresent(self):
     """Even with the skip_passes argument, an unexpected PASS should be present"""
     xfail_phase = test_status.CORE_PHASES[-1]
     xfails = expected_fails.ExpectedFails()
     xfails.add_failure(phase=xfail_phase,
                        expected_status=test_status.TEST_FAIL_STATUS)
     output = self._ts.phase_statuses_dump(skip_passes=True, xfails=xfails)
     self.assert_status_of_phase(output,
                                 test_status.TEST_PASS_STATUS,
                                 xfail_phase,
                                 self._TESTNAME,
                                 xfail='unexpected')
     for phase in test_status.CORE_PHASES:
         if phase != xfail_phase:
             self.assert_phase_absent(output, phase, self._TESTNAME)