diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py index d5b5431b6d0d19e1e509dc689db735a9f18e4107..338f4eeb7e7479902dd144a97986d5acfdafd367 100644 --- a/product/ERP5Type/tests/ERP5TypeTestCase.py +++ b/product/ERP5Type/tests/ERP5TypeTestCase.py @@ -388,7 +388,7 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase): def _getBTPathAndIdList(self, template_list): INSTANCE_HOME = os.environ['INSTANCE_HOME'] - bt5_path = os.environ.get('erp5_tests_bt5_path', + erp5_tests_bt5_path = os.environ.get('erp5_tests_bt5_path', os.path.join(INSTANCE_HOME, 'bt5')) erp5_product_path = os.path.dirname(Products.ERP5.__file__) bootstrap_path = os.environ.get('erp5_tests_bootstrap_path', @@ -401,30 +401,36 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase): file, headers = urlretrieve(template) except IOError : # First, try the bt5 directory itself. - path = os.path.join(bt5_path, template) - alternate_path = os.path.join(bootstrap_path, template) - if os.path.exists(path): - template = path - elif os.path.exists(alternate_path): - template = alternate_path - else: - path = '%s.bt5' % path + original_template = template + for bt5_path in erp5_tests_bt5_path.split(','): + template = original_template + path = os.path.join(bt5_path, template) + alternate_path = os.path.join(bootstrap_path, template) if os.path.exists(path): template = path + break + elif os.path.exists(alternate_path): + template = alternate_path + break else: - # Otherwise, look at sub-directories. - # This is for backward-compatibility. - path = os.path.join(INSTANCE_HOME, 'bt5', '*', template) - template_list = glob(path) - if len(template_list) == 0: - template_list = glob('%s.bt5' % path) - if len(template_list) and template_list[0]: - template = template_list[0] + path = '%s.bt5' % path + if os.path.exists(path): + template = path + break else: - # The last resort is current directory. - template = '%s' % id - if not os.path.exists(template): - template = '%s.bt5' % id + # Otherwise, look at sub-directories. + # This is for backward-compatibility. + path = os.path.join(INSTANCE_HOME, 'bt5', '*', template) + template_list = glob(path) + if len(template_list) == 0: + template_list = glob('%s.bt5' % path) + if len(template_list) and template_list[0]: + template = template_list[0] + else: + # The last resort is current directory. + template = '%s' % id + if not os.path.exists(template): + template = '%s.bt5' % id else: template = '%s' % template if not os.path.exists(template): diff --git a/product/ERP5Type/tests/runUnitTest.py b/product/ERP5Type/tests/runUnitTest.py index 1d8b31e43bea05d27a35b6d6f6d3eb794084dfeb..7fe711cae0e88f6111d16cc463333510c01cf93a 100755 --- a/product/ERP5Type/tests/runUnitTest.py +++ b/product/ERP5Type/tests/runUnitTest.py @@ -369,12 +369,17 @@ def runUnitTestList(test_list, verbosity=1, debug=0): from glob import glob product_test_list = glob(os.path.join(products_home, '*', 'tests')) sys.path.extend(product_test_list) - bt5_path = os.environ.get('erp5_tests_bt5_path', - os.path.join(instance_home, 'bt5')) - bt5_test_list = glob(os.path.join(bt5_path, '*', 'TestTemplateItem')) + erp5_tests_bt5_path = os.environ.get('erp5_tests_bt5_path', + os.path.join(instance_home, 'bt5')) + bt5_path_list = erp5_tests_bt5_path.split(",") + bt5_test_list = [] + project_bt5_test_list = [] + for bt5_path in bt5_path_list: + bt5_test_list.extend(glob(os.path.join(bt5_path,'*','TestTemplateItem'))) + # also suport instance_home/bt5/project_bt5/* + project_bt5_test_list.extend(glob(os.path.join(bt5_path, '*', '*', + 'TestTemplateItem'))) sys.path.extend(bt5_test_list) - # also suport instance_home/bt5/project_bt5/* - project_bt5_test_list = glob(os.path.join(bt5_path, '*', '*', 'TestTemplateItem')) sys.path.extend(project_bt5_test_list) sys.path.extend((real_tests_home, tests_home))