def loadTests(self): for file in self.__files: mod = runtestHelpers.loadModule(file) candidates = dir(mod) for candidate in candidates: candidate = getattr(mod, candidate) try: if issubclass(candidate, unittest.TestCase): loader = unittest.TestLoader() loader.testMethodPrefix = self.__testMethodPrefix artifact_dir = self.getArtifactDir( candidate.artifact_type) candidate.language = self.__lang if candidate.comp_list: artifact_list = candidate.comp_list else: artifact_list = self.getTestNames(artifact_dir) # temporarily remove test_spd_dep test until it is fix artifact_list = removeAll(artifact_list, candidate.remove_list) if not self.__enableOctave: # If not testing octave, remove the octave test # from the list. # TODO: intelligently get a list of all tests # beginning with "octave" artifact_list = removeAll( artifact_list, ["octaveTest0", "octaveTest1"]) if self.__comp_name: if not (self.__comp_name in artifact_list): artifact_list = [] else: artifact_list = [self.__comp_name] #change attributes for the loaded test classes for curr in artifact_list: test_list = loader.loadTestsFromTestCase(candidate) for subtest in test_list: subtest.artifact_name = curr # Strip namespace to get the base name subtest.base_name = curr.split('.')[-1] subtest.artifact_dir = artifact_dir subtest.artifact_module_directory = os.path.join( artifact_dir, '[NAME]/tests') if self.__enableOctave: if 'octaveTest' in subtest.artifact_name: subtest.octave_test_dir = True self.addTest(test_list) except TypeError, e: pass
def loadTests(self): for file in self.__files: mod = runtestHelpers.loadModule(file) candidates = dir(mod) for candidate in candidates: candidate = getattr(mod, candidate) try: if issubclass(candidate, unittest.TestCase): print "LOADING" loader = PromptTestLoader() loader.PROMPT = self.__prompt loader.testMethodPrefix = self.__testMethodPrefix self.addTest(loader.loadTestsFromTestCase(candidate)) except TypeError, e: pass
def loadTests(self): for file in self.__files: mod = runtestHelpers.loadModule(file) candidates = dir(mod) for candidate in candidates: candidate = getattr(mod, candidate) try: if issubclass(candidate, unittest.TestCase): print "LOADING" loader = PromptTestLoader() loader.PROMPT = self.__prompt loader.testMethodPrefix = self.__testMethodPrefix self.addTest(loader.loadTestsFromTestCase(candidate)) except TypeError, e: pass
def loadTests(self): for file in self.__files: mod = runtestHelpers.loadModule(file) candidates = dir(mod) for candidate in candidates: candidate = getattr(mod, candidate) try: if issubclass(candidate, unittest.TestCase): reason = getattr(candidate, 'skip_reason', False) if reason: print "SKIPPING: {0} - '{1}'".format(candidate.__name__, reason) continue print "LOADING" loader = PromptTestLoader() loader.PROMPT = self.__prompt loader.testMethodPrefix = self.__testMethodPrefix self.addTest(loader.loadTestsFromTestCase(candidate)) except TypeError, e: pass