From a7537daa85e20b263510a6eafaf6e0bc3b67f744 Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine <arnaud.fontaine@nexedi.com> Date: Wed, 25 Nov 2015 19:03:38 +0900 Subject: [PATCH] ERP5TypeTestCase: --update_business_templates --update_only didn't work with ZODB Test Components. With ZODB Components, getBusinessTemplateList() only returns the test bt5 (as given on the command line, such as BT_TITLE:testFoo) and later it resolves dependencies. So filtering bt5 to be updated should be done as late as possible... --- product/ERP5Type/tests/ERP5TypeTestCase.py | 31 +++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py index dc6e8924e1..6db6e50545 100644 --- a/product/ERP5Type/tests/ERP5TypeTestCase.py +++ b/product/ERP5Type/tests/ERP5TypeTestCase.py @@ -767,20 +767,8 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): update_business_templates = os.environ.get('update_business_templates') is not None erp5_load_data_fs = int(os.environ.get('erp5_load_data_fs', 0)) if update_business_templates and erp5_load_data_fs: - update_only = os.environ.get('update_only', None) template_list[:0] = (erp5_catalog_storage, 'erp5_property_sheets', 'erp5_core', 'erp5_xhtml_style') - # 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 # keep a mapping type info name -> property sheet list, to remove them in # tear down. @@ -876,11 +864,28 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): quiet=True): template_tool = self.portal.portal_templates update_business_templates = os.environ.get('update_business_templates') is not None + erp5_load_data_fs = int(os.environ.get('erp5_load_data_fs', 0)) BusinessTemplate_getModifiedObject = aq_base( getattr(self.portal, 'BusinessTemplate_getModifiedObject', None)) - # Add some business templates + update_only = os.environ.get('update_only', ()) + if update_only: + update_only = update_only.split(',') + + def _isUpdateOnlyBusinessTemplate(bt_title): + for expression in update_only: + if re.search(expression, bt_title): + return True + + return False + for url, bt_title in business_template_list: + if (update_business_templates and + erp5_load_data_fs and + update_only and + not _isUpdateOnlyBusinessTemplate(bt_title)): + continue + start = time.time() get_install_kw = False if bt_title in template_tool.getInstalledBusinessTemplateTitleList(): -- 2.30.9