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)
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)
def _generate_metadata(self): return LibraryMetadata( **{ 'name': 'Test Library', 'status': Status.Unscheduled, 'result': Result(Result.NotRun) })
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 })
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) })
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) })
def avoid_children(self, reason): for testable in self.testable: testable.result = Result(self.testable.result.value, reason) testable.status = Status.Avoided
def handle_skip(self, trace): self.testable.result = Result(Result.Skipped, trace) self.avoid_children(trace)
def handle_error(self, trace): self.testable.result = Result(Result.Errored, trace) self.avoid_children(trace)