[Erp5-report] r33196 rafael - /erp5/trunk/products/ERP5Type/tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Mar 1 21:11:48 CET 2010
Author: rafael
Date: Mon Mar 1 21:11:46 2010
New Revision: 33196
URL: http://svn.erp5.org?rev=33196&view=rev
Log:
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.
Modified:
erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
erp5/trunk/products/ERP5Type/tests/runUnitTest.py
Modified: erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py?rev=33196&r1=33195&r2=33196&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] Mon Mar 1 21:11:46 2010
@@ -388,7 +388,7 @@
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 @@
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):
Modified: erp5/trunk/products/ERP5Type/tests/runUnitTest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/runUnitTest.py?rev=33196&r1=33195&r2=33196&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] Mon Mar 1 21:11:46 2010
@@ -369,12 +369,17 @@
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))
More information about the Erp5-report
mailing list