[Erp5-report] r24858 - /erp5/trunk/products/ERP5Type/tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Dec 11 10:59:54 CET 2008


Author: seb
Date: Thu Dec 11 10:59:52 2008
New Revision: 24858

URL: http://svn.erp5.org?rev=24858&view=rev
Log:
- add --update_only business template, this allows to update
  only some parts of the business templates, this is really
  usefull when you are doing changes only on a few business
  templates in combination with the load option

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=24858&r1=24857&r2=24858&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] Thu Dec 11 10:59:52 2008
@@ -317,7 +317,19 @@
       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 @@
                 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]

Modified: erp5/trunk/products/ERP5Type/tests/runUnitTest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/runUnitTest.py?rev=24858&r1=24857&r2=24858&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] Thu Dec 11 10:59:52 2008
@@ -64,6 +64,13 @@
                              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 @@
         "load",
         "email_from_address=",
         "run_only=",
+        "update_only=",
         "update_business_templates"] )
   except getopt.GetoptError, msg:
     usage(sys.stderr, msg)
@@ -417,6 +425,8 @@
       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"
 




More information about the Erp5-report mailing list