Commit 7efd3421 authored by Julien Muchembled's avatar Julien Muchembled

bin/runUnitTest: code readibility

The only functional change is the following:
- before: sys.path begins with [*/product/*/tests] followed by [*/tests]
- after: sys.path begins with [prj1/product/*/tests, prj1/tests,
                               prj2/product/*/tests, prj2/tests,
                               ...]
This should have no impact.
parent a03793d3
...@@ -239,25 +239,24 @@ entry-points = ...@@ -239,25 +239,24 @@ entry-points =
runUnitTest=Products.ERP5Type.tests.runUnitTest:main runUnitTest=Products.ERP5Type.tests.runUnitTest:main
scripts = runUnitTest scripts = runUnitTest
initialization = initialization =
import os import glob, imp, os, sys
import sys
import Products import Products
[Products.__path__.insert(0, p) for p in reversed(os.environ.get('INSERT_PRODUCTS_PATH', '').split(':')) if p] Products.__path__[:0] = filter(None,
os.getenv('INSERT_PRODUCTS_PATH', '').split(os.pathsep))
Products.__path__.extend(reversed('''${products:list}'''.split())) Products.__path__.extend(reversed('''${products:list}'''.split()))
import Zope2 os.environ['SOFTWARE_HOME'] = os.path.abspath(imp.find_module('Zope2')[1])
os.environ['SOFTWARE_HOME'] = os.path.abspath(os.path.dirname(os.path.dirname(Zope2.__file__)))
os.environ['ZOPE_SCRIPTS'] = '' os.environ['ZOPE_SCRIPTS'] = ''
parts_directory = '''${buildout:parts-directory}''' parts_directory = '''${buildout:parts-directory}'''
repository_id_list = list(reversed('''${erp5_repository_list:repository_id_list}'''.split()))
temp_bt5_path_list = ['/'.join([parts_directory, x, 'bt5']) for x in repository_id_list]
bt5_path_list = [] bt5_path_list = []
[bt5_path_list.extend([bt5_path, '%s/*' % bt5_path]) for bt5_path in temp_bt5_path_list] test_path_list = []
for r in reversed('''${erp5_repository_list:repository_id_list}'''.split()):
r = os.path.join(parts_directory, r)
bt5_path = os.path.join(r, 'bt5')
bt5_path_list += bt5_path, os.path.join(bt5_path, '*')
test_path_list += glob.glob(os.path.join(r, 'product', '*', 'tests'))
test_path_list.append(os.path.join(r, 'tests'))
os.environ['erp5_tests_bt5_path'] = ','.join(bt5_path_list) os.environ['erp5_tests_bt5_path'] = ','.join(bt5_path_list)
sys.path[0:0] = ['/'.join([parts_directory, x, 'tests']) for x in repository_id_list] sys.path[:0] = test_path_list
import glob
product_test_path_list = []
[product_test_path_list.extend(glob.glob('/'.join([parts_directory, x, 'product/*/tests']))) for x in repository_id_list]
sys.path[0:0] = product_test_path_list
[test_suite_runner] [test_suite_runner]
# XXX: Workaround for fact ERP5Type is not an distribution and does not # XXX: Workaround for fact ERP5Type is not an distribution and does not
......
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