From 6d7620582db12bc7aa81c1d7f6c5da3f470a93b2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 14:16:15 +0200 Subject: [PATCH] run all test suites, if called as main Signed-off-by: Nico Schottelius --- lib/cdist/test/__main__.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/cdist/test/__main__.py b/lib/cdist/test/__main__.py index eba262fa..08e839d1 100644 --- a/lib/cdist/test/__main__.py +++ b/lib/cdist/test/__main__.py @@ -1,4 +1,3 @@ -#c1406:!/usr/bin/env python3 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # @@ -36,16 +35,14 @@ for possible_test in os.listdir(base_dir): if os.path.isfile(mod_path): test_modules.append(possible_test) -print(sys.path) - suites = [] - for test_module in test_modules: - module = imp.find_module(test_module, [base_dir]) - imp.load_module(test_module, *module) + module_parameters = imp.find_module(test_module, [base_dir]) + module = imp.load_module("cdist.test." + test_module, *module_parameters) - print(module) - # module_name = - - suite = unittest.defaultTestLoader.loadTestsFromModule("cdist.test." + test_module) + suite = unittest.defaultTestLoader.loadTestsFromModule(module) + # print("Got suite: " + suite.__str__()) suites.append(suite) + +all_suites = unittest.TestSuite(suites) +unittest.TextTestRunner(verbosity=2).run(all_suites)