Commit bb4db5fe authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor code to be possible pass the parameter bt5_path to runTestSuite. With...

refactor code to be possible pass the parameter bt5_path to runTestSuite. With this, runTestSuite script can propagate this parameter to runUnitTest script
parent 230fe3eb
......@@ -105,8 +105,14 @@ def main(*args):
for section in config.sections():
if section.startswith('vcs_repository'):
vcs_repository_list.append(dict(config.items(section)))
CONFIG['vcs_repository_list'] = vcs_repository_list
CONFIG['bt5_path'] = None
if 'bt5_path' in config.options("testnode"):
bt5_path = config.get("testnode", 'bt5_path')
if bt5_path.lower() != "none":
CONFIG['bt5_path'] = bt5_path
CONFIG['vcs_repository_list'] = vcs_repository_list
CONFIG['test_suite_title'] = geto('test_suite_title')
CONFIG['test_node_title'] = geto('test_node_title')
CONFIG['test_suite'] = geto('test_suite')
......@@ -127,5 +133,4 @@ def main(*args):
if 'instance_dict' in config.sections():
instance_dict = dict(config.items('instance_dict'))
CONFIG['instance_dict'] = instance_dict
testnode.run(CONFIG)
......@@ -138,6 +138,7 @@ def run(config):
[buildout]
extends = %(software_config_path)s
""" % {'software_config_path': os.path.join(repository_path, profile_path)}
if not(buildout_section_id is None):
profile_content += """
[%(buildout_section_id)s]
......@@ -267,6 +268,9 @@ branch = %(branch)s
'--test_suite_title', test_suite_title,
'--node_quantity', config['node_quantity'],
'--master_url', config['test_suite_master_url']])
bt5_path_list = config.get("bt5_path")
if bt5_path_list is not None:
invocation_list.extend(["--bt5_path", bt5_path_list])
# From this point, test runner becomes responsible for updating test
# result.
# XXX: is it good for all cases (eg: test runner fails too early for
......
......@@ -301,6 +301,8 @@ class SavedTestSuite(ERP5TypeTestSuite):
super(SavedTestSuite, self).__init__(*args, **kw)
def __runUnitTest(self, *args, **kw):
if self.__dict__.has_key("bt5_path"):
args = ("--bt5_path=%s" % self.bt5_path,) + args
return super(SavedTestSuite, self).runUnitTest(
'--portal_id=' + self._portal_id,
*args, **kw)
......
......@@ -4,7 +4,7 @@ from DummyTaskDistributionTool import DummyTaskDistributionTool
from ERP5TypeTestSuite import ERP5TypeTestSuite
def makeSuite(node_quantity=None, test_suite=None, revision=None,
db_list=None):
db_list=None, **kwargs):
# BBB tests (plural form) is only checked for backward compatibility
for k in sys.modules.keys():
if k in ('tests', 'test',) or k.startswith('tests.') or k.startswith('test.'):
......@@ -25,7 +25,7 @@ def makeSuite(node_quantity=None, test_suite=None, revision=None,
suite = suite_class(revision=revision,
max_instance_count=node_quantity,
mysql_db_list=db_list.split(','),
)
**kwargs)
return suite
def safeRpcCall(function, *args):
......@@ -69,8 +69,11 @@ def main():
parser.add_argument('--volatile_memcached_server_port', default=None)
parser.add_argument('--persistent_memcached_server_hostname', default=None)
parser.add_argument('--persistent_memcached_server_port', default=None)
parser.add_argument('--bt5_path', default=None)
args = parser.parse_args()
if args.bt5_path is not None:
sys.path[0:0] = args.bt5_path.split(",")
if args.master_url is not None:
master_url = args.master_url
if master_url[-1] != '/':
......@@ -86,7 +89,8 @@ def main():
suite = makeSuite(test_suite=args.test_suite,
node_quantity=args.node_quantity,
revision=revision,
db_list=args.db_list)
db_list=args.db_list,
bt5_path=args.bt5_path)
test_result = safeRpcCall(master.createTestResult,
args.test_suite, revision, suite.getTestList(),
suite.allow_restart, test_suite_title, args.test_node_title,
......
......@@ -686,7 +686,8 @@ def main(argument_list=None):
os.environ["erp5_tests_data_fs_path"] = arg
os.environ["erp5_tests_recreate_catalog"] = "1"
elif opt == '--bt5_path':
os.environ["erp5_tests_bt5_path"] = arg
os.environ["erp5_tests_bt5_path"] = \
os.environ.get("erp5_tests_bt5_path", "") + arg
elif opt == '--recreate_catalog':
os.environ["erp5_tests_recreate_catalog"] = arg
elif opt == "--erp5_sql_connection_string":
......
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