def test_whole_module_import(self): classes = TestLoader.get_class_names_from_module('tests.dummy_modules') expected = set([ "tests.dummy_modules.mod1.ModuleOneHalf", "tests.dummy_modules.mod1.ModuleTwoHalves", "tests.dummy_modules.bars.testset_subclass.TestSetSubclass", "tests.dummy_modules.bars.testset_subclass_subclass.TestSetSubclassSubclass", ]) self.assertEqual(classes, expected)
def add_tests(self, test_json): """Takes a list of tests in the format required by the configuration file and adds them to the tests that this TestRunner will run.""" configuration = test_json['configuration'] for thread in test_json['tests']: work_provider = WorkProvider() work_nodes = [] for test in thread: test_obj = { 'test': test, 'configuration': configuration, 'environment': {}, } work_nodes.extend(TestLoader.get_work_nodes_for_test(test_obj)) work_provider.add_nodes(*work_nodes) self.work_providers.append(work_provider)
def add_tests(self, test_json): """Takes a list of tests in the format required by the configuration file and adds them to the tests that this TestRunner will run.""" tests_objs = AutoThreadedTestRunner._build_tests(test_json) work_nodes = TestLoader.get_work_nodes_for_tests(tests_objs) self.work_provider.add_nodes(*work_nodes)
def test_non_testset(self): self.assertFalse(TestLoader.is_testset(ModuleOneHalf)) self.assertFalse(TestLoader.is_testset(ModuleTwoHalves))
def test_indirect_subclass(self): self.assertTrue(TestLoader.is_testset(TestSetSubclassSubclass))
def test_get_class_from_full_name(self): class_name = "tests.dummy_modules.mod1.ModuleOneHalf" cls = TestLoader.get_class_from_name(class_name) self.assertEqual(cls, ModuleOneHalf)