Esempio n. 1
0
def compute_aggregate_result(iterable):
    '''        
    Status of the test suite by default is:
    * Passed if all contained tests passed
    * Errored if any contained tests errored
    * Failed if no tests errored, but one or more failed.
    * Skipped if all contained tests were skipped
    '''
    failed = []
    skipped = []
    for testitem in iterable:
        result = testitem.result

        if result.value == Result.Errored:
            return Result(result.value, result.reason)
        elif result.value == Result.Failed:
            failed.append(result.reason)
        elif result.value == result.Skipped:
            skipped.append(result.reason)
    if failed:
        return Result(Result.Failed, failed)
    elif skipped:
        return Result(Result.Skipped, skipped)
    else:
        return Result(Result.Passed)
Esempio n. 2
0
 def sandbox_test(self):
     try:
         sandbox.Sandbox(TestParameters(
                 self.testable, 
                 self.testable.parent_suite))
     except sandbox.SubprocessException:
         self.testable.result = Result(Result.Failed, traceback.format_exc())
     else:
         self.testable.result = Result(Result.Passed)
Esempio n. 3
0
 def _generate_metadata(self):
     return LibraryMetadata(
         **{
             'name': 'Test Library',
             'status': Status.Unscheduled,
             'result': Result(Result.NotRun)
         })
Esempio n. 4
0
 def _generate_metadata(self):
     return TestCaseMetadata(
         **{
             'name': self.obj.name,
             'path': self._path,
             'uid': uid.uid(self.obj, self._path),
             'status': Status.Unscheduled,
             'result': Result(Result.NotRun),
             'suite_uid': self.parent_suite.metadata.uid
         })
Esempio n. 5
0
 def _generate_metadata(self):
     return TestSuiteMetadata(
         **{
             'name': self.obj.name,
             'tags': self.obj.tags,
             'path': self._path,  # TODO Loader supply info?
             'uid': uid.uid(self.obj, self._path),  # TODO Requires path
             'status': Status.Unscheduled,
             'result': Result(Result.NotRun)
         })
Esempio n. 6
0
 def _generate_metadata(self):
     return TestSuiteMetadata(
         **{
             'name': self.obj.name,
             'tags': self.obj.tags,
             'path': self._path,
             'uid': uid.SuiteUID(self._path, self.obj.name),
             'status': Status.Unscheduled,
             'result': Result(Result.NotRun)
         })
Esempio n. 7
0
 def avoid_children(self, reason):
     for testable in self.testable:
         testable.result = Result(self.testable.result.value, reason)
         testable.status = Status.Avoided
Esempio n. 8
0
 def handle_skip(self, trace):
     self.testable.result = Result(Result.Skipped, trace)
     self.avoid_children(trace)
Esempio n. 9
0
 def handle_error(self, trace):
     self.testable.result = Result(Result.Errored, trace)
     self.avoid_children(trace)