def run_tests(self): """Run selected testcases. Implementation of this method is crucial as a general tests execution workflow. Returns: main script exit code denoting the execution result. """ ret = 0 for tc in self.testcases: # TODO handle test type inside custom decorator if tc.test_type not in self.config.test_type: continue if not tc.enabled: continue cf = CtxFilter(self.config, tc) # The 'c' context has to be initialized before the 'for' loop, # because cf.get_contexts() can return no value ([]) # and in case of the 'futils.Fail' exception # self._test_failed(tc, c, f) will be called # with uninitilized value of the 'c' context. c = None try: for c in cf.get_contexts(): try: t = tc() if t.enabled: self.msg.print('{}: SETUP\t({}/{})' .format(t, t.test_type, c)) t._execute(c) else: continue except futils.Skip as s: self.msg.print_verbose('{}: SKIP: {}'.format(t, s)) except futils.Fail as f: self._test_failed(t, c, f) ret = 1 else: self._test_passed(t) except futils.Skip as s: self.msg.print_verbose('{}: SKIP: {}'.format(tc, s)) except futils.Fail as f: self._test_failed(tc, c, f) ret = 1 return ret
def run_tests(self): """Run selected testcases""" ret = 0 for tc in self.testcases: # TODO handle test type inside custom decorator if tc.test_type not in self.config.test_type: continue if not tc.enabled: continue cf = CtxFilter(self.config, tc) try: for c in cf.get_contexts(): try: t = tc() if t.enabled: self.msg.print('{}: SETUP\t({}/{})'.format( t, t.test_type, c)) t._execute(c) else: continue except futils.Skip as s: self.msg.print_verbose('{}: SKIP: {}'.format(t, s)) except futils.Fail as f: self._test_failed(t, c, f) ret = 1 else: self._test_passed(t) except futils.Skip as s: self.msg.print_verbose('{}: SKIP: {}'.format(tc, s)) except futils.Fail as f: self._test_failed(tc, c, f) ret = 1 return ret