Commit 857e647a authored by Rafael Monnerat's avatar Rafael Monnerat

Extend the support of --bt5-path= argument to support multiple values like:

 --bt5-path=bt5/folder/0,bt5/folder/3,another/bt5

Values split by Comma format was choose because it is already used by run_only and update_only. 



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33196 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 68cf9524
......@@ -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,16 +401,22 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
file, headers = urlretrieve(template)
except IOError :
# First, try the bt5 directory itself.
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:
path = '%s.bt5' % path
if os.path.exists(path):
template = path
break
else:
# Otherwise, look at sub-directories.
# This is for backward-compatibility.
......
......@@ -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',
erp5_tests_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'))
sys.path.extend(bt5_test_list)
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 = glob(os.path.join(bt5_path, '*', '*', 'TestTemplateItem'))
project_bt5_test_list.extend(glob(os.path.join(bt5_path, '*', '*',
'TestTemplateItem')))
sys.path.extend(bt5_test_list)
sys.path.extend(project_bt5_test_list)
sys.path.extend((real_tests_home, tests_home))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment