diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py index ef7d23a01de67ea1d7d24a4734d5678602a49a7d..cde40fe170767545a47ae7ce3cb52336b06bc17c 100644 --- a/product/ERP5Type/tests/ERP5TypeTestCase.py +++ b/product/ERP5Type/tests/ERP5TypeTestCase.py @@ -317,7 +317,19 @@ class ERP5TypeTestCase(PortalTestCase): update_business_templates = os.environ.get('update_business_templates') is not None erp5_load_data_fs = os.environ.get('erp5_load_data_fs') is not None if update_business_templates and erp5_load_data_fs: + update_only = os.environ.get('update_only', None) template_list = (erp5_catalog_storage, 'erp5_core', 'erp5_xhtml_style') + tuple(template_list) + # Update only specified business templates, regular expression + # can be used. + if update_only is not None: + update_only_list = update_only.split(',') + matching_template_list = [] + # First parse the template list in order to keep same order + for business_template in template_list: + for expression in update_only_list: + if re.search(expression, business_template): + matching_template_list.append(business_template) + template_list = matching_template_list new_template_list = [] for template in template_list: id = template.split('/')[-1] @@ -686,6 +698,7 @@ class ERP5TypeTestCase(PortalTestCase): ZopeTestCase._print('(imported in %.3fs) ' % (time.time() - start)) install_kw = None if get_install_kw: + install_kw = {} listbox_object_list = BusinessTemplate_getModifiedObject.__of__(bt)() for listbox_line in listbox_object_list: install_kw[listbox_line.object_id] = listbox_line.choice_item_list[0][1] diff --git a/product/ERP5Type/tests/runUnitTest.py b/product/ERP5Type/tests/runUnitTest.py index e553a9a79e7b94445e4bbf0b6da3b3dc857a7f21..be3c05a76908840d9623e3e650249d3cd1292a50 100755 --- a/product/ERP5Type/tests/runUnitTest.py +++ b/product/ERP5Type/tests/runUnitTest.py @@ -64,6 +64,13 @@ Options: Update all business templates prior to runing tests. This only has a meaning when doing upgratability checks, in conjunction with --load. + --update_only can be use to restrict the list of + templates to update. + --update_only=STRING + Specify the list of business template to update if + you don't want to update them all. You can give a list + delimited with commans (e.g. erp5_core,erp5_xhtml_style). + This can be regular expressions. """ def getUnitTestFile(): @@ -359,6 +366,7 @@ def main(): "load", "email_from_address=", "run_only=", + "update_only=", "update_business_templates"] ) except getopt.GetoptError, msg: usage(sys.stderr, msg) @@ -417,6 +425,8 @@ def main(): os.environ["erp5_catalog_storage"] = arg elif opt == "--run_only": os.environ["run_only"] = arg + elif opt == "--update_only": + os.environ["update_only"] = arg elif opt == "--update_business_templates": os.environ["update_business_templates"] = "1"