diff --git a/product/ERP5Type/tests/runUnitTest.py b/product/ERP5Type/tests/runUnitTest.py index 9ebe5ca873a46e32a84d415cdd42730e9acd24db..3c5b794be87caacf06bc6e91e36adaa176411e1e 100755 --- a/product/ERP5Type/tests/runUnitTest.py +++ b/product/ERP5Type/tests/runUnitTest.py @@ -30,10 +30,18 @@ def runUnitTestList(test_list) : os.chdir(tests_home) + # allow unit tests of our Products to be reached. + products_home = os.path.join(instance_home, 'Products') + from glob import glob + product_test_list = glob(products_home + os.sep + '*' + os.sep + 'tests') + sys.path += product_test_list + for test in test_list: m = __import__(test) - if hasattr(m, 'test_suite'): - suite.addTest(m.test_suite()) + for attr_name in dir(m) : + attr = getattr(m, attr_name) + if (type(attr) == type(type)) and (hasattr(attr, '__module__')) and (attr.__module__ == test) : + suite.addTest(unittest.makeSuite(attr)) TestRunner().run(suite)