[Erp5-report] r37176 luke - in /erp5/release/candidate: profiles/ release-patch/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jul 16 17:15:47 CEST 2010


Author: luke
Date: Fri Jul 16 17:15:40 2010
New Revision: 37176

URL: http://svn.erp5.org?rev=37176&view=rev
Log:
 - backport:
/erp5/trunk/products/ERP5/Tool/TemplateTool.py[37132:37165]
/erp5/trunk/products/ERP5Type/tests/runUnitTest.py[37135:37137]
/erp5/trunk/products/ERP5/bootstrap/erp5_core[37166]
To have more robust implementation of running unit tests from instance.

Added:
    erp5/release/candidate/release-patch/ERP5-tests-from-instance.patch
    erp5/release/candidate/release-patch/ERP5Type-tests-from-instance.patch
Modified:
    erp5/release/candidate/profiles/release.cfg

Modified: erp5/release/candidate/profiles/release.cfg
URL: http://svn.erp5.org/erp5/release/candidate/profiles/release.cfg?rev=37176&r1=37175&r2=37176&view=diff
==============================================================================
--- erp5/release/candidate/profiles/release.cfg [utf8] (original)
+++ erp5/release/candidate/profiles/release.cfg [utf8] Fri Jul 16 17:15:40 2010
@@ -5,5 +5,7 @@ parts += release-patch
 
 [release-patch]
 recipe = plone.recipe.command
-command = cd ${buildout:directory}/parts/products-erp5/ && patch -p2 < ${buildout:directory}/release-patch/unindexObject.patch
+command =
+  cd ${buildout:directory}/parts/products-erp5/ && patch -p2 < ${buildout:directory}/release-patch/unindexObject.patch
+  cd ${buildout:directory}/parts/products-erp5/ && patch -p0 < ${buildout:directory}/release-patch/ERP5-tests-from-instance.patch && patch -p0 < ${buildout:directory}/release-patch/ERP5Type-tests-from-instance.patch
 update-command = echo "Do nothing"

Added: erp5/release/candidate/release-patch/ERP5-tests-from-instance.patch
URL: http://svn.erp5.org/erp5/release/candidate/release-patch/ERP5-tests-from-instance.patch?rev=37176&view=auto
==============================================================================
--- erp5/release/candidate/release-patch/ERP5-tests-from-instance.patch (added)
+++ erp5/release/candidate/release-patch/ERP5-tests-from-instance.patch [utf8] Fri Jul 16 17:15:40 2010
@@ -0,0 +1,401 @@
+Index: ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewUnitTestRunDialog.xml
+===================================================================
+--- ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewUnitTestRunDialog.xml	(revision 36706)
++++ ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewUnitTestRunDialog.xml	(working copy)
+@@ -65,6 +65,7 @@
+                     <value>
+                       <list>
+                         <string>your_test_list</string>
++                        <string>your_repository_list</string>
+                         <string>your_sql_connection_string</string>
+                       </list>
+                     </value>
+Index: ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewUnitTestRunDialog/your_repository_list.xml
+===================================================================
+--- ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewUnitTestRunDialog/your_repository_list.xml	(revision 0)
++++ ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewUnitTestRunDialog/your_repository_list.xml	(revision 0)
+@@ -0,0 +1,320 @@
++<?xml version="1.0"?>
++<ZopeData>
++  <record id="1" aka="AAAAAAAAAAE=">
++    <pickle>
++      <tuple>
++        <global name="LinesField" module="Products.Formulator.StandardFields"/>
++        <tuple/>
++      </tuple>
++    </pickle>
++    <pickle>
++      <dictionary>
++        <item>
++            <key> <string>id</string> </key>
++            <value> <string>your_repository_list</string> </value>
++        </item>
++        <item>
++            <key> <string>message_values</string> </key>
++            <value>
++              <dictionary>
++                <item>
++                    <key> <string>external_validator_failed</string> </key>
++                    <value> <string>The input failed the external validator.</string> </value>
++                </item>
++                <item>
++                    <key> <string>line_too_long</string> </key>
++                    <value> <string>A line was too long.</string> </value>
++                </item>
++                <item>
++                    <key> <string>required_not_found</string> </key>
++                    <value> <string>Input is required but no input given.</string> </value>
++                </item>
++                <item>
++                    <key> <string>too_long</string> </key>
++                    <value> <string>You entered too many characters.</string> </value>
++                </item>
++                <item>
++                    <key> <string>too_many_lines</string> </key>
++                    <value> <string>You entered too many lines.</string> </value>
++                </item>
++              </dictionary>
++            </value>
++        </item>
++        <item>
++            <key> <string>overrides</string> </key>
++            <value>
++              <dictionary>
++                <item>
++                    <key> <string>alternate_name</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>css_class</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>default</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>description</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>editable</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>enabled</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>external_validator</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>extra</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>height</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>hidden</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>max_length</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>max_linelength</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>max_lines</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>required</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>title</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>unicode</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>view_separator</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>whitespace_preserve</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>width</string> </key>
++                    <value> <string></string> </value>
++                </item>
++              </dictionary>
++            </value>
++        </item>
++        <item>
++            <key> <string>tales</string> </key>
++            <value>
++              <dictionary>
++                <item>
++                    <key> <string>alternate_name</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>css_class</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>default</string> </key>
++                    <value>
++                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
++                    </value>
++                </item>
++                <item>
++                    <key> <string>description</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>editable</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>enabled</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>external_validator</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>extra</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>height</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>hidden</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>max_length</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>max_linelength</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>max_lines</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>required</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>title</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>unicode</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>view_separator</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>whitespace_preserve</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>width</string> </key>
++                    <value> <string></string> </value>
++                </item>
++              </dictionary>
++            </value>
++        </item>
++        <item>
++            <key> <string>values</string> </key>
++            <value>
++              <dictionary>
++                <item>
++                    <key> <string>alternate_name</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>css_class</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>default</string> </key>
++                    <value>
++                      <list/>
++                    </value>
++                </item>
++                <item>
++                    <key> <string>description</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>editable</string> </key>
++                    <value> <int>1</int> </value>
++                </item>
++                <item>
++                    <key> <string>enabled</string> </key>
++                    <value> <int>1</int> </value>
++                </item>
++                <item>
++                    <key> <string>external_validator</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>extra</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>height</string> </key>
++                    <value> <int>5</int> </value>
++                </item>
++                <item>
++                    <key> <string>hidden</string> </key>
++                    <value> <int>0</int> </value>
++                </item>
++                <item>
++                    <key> <string>max_length</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>max_linelength</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>max_lines</string> </key>
++                    <value> <string></string> </value>
++                </item>
++                <item>
++                    <key> <string>required</string> </key>
++                    <value> <int>0</int> </value>
++                </item>
++                <item>
++                    <key> <string>title</string> </key>
++                    <value> <string>Business Template Repositories</string> </value>
++                </item>
++                <item>
++                    <key> <string>unicode</string> </key>
++                    <value> <int>0</int> </value>
++                </item>
++                <item>
++                    <key> <string>view_separator</string> </key>
++                    <value> <string encoding="cdata"><![CDATA[
++
++<br />\n
++
++
++]]></string> </value>
++                </item>
++                <item>
++                    <key> <string>whitespace_preserve</string> </key>
++                    <value> <int>0</int> </value>
++                </item>
++                <item>
++                    <key> <string>width</string> </key>
++                    <value> <int>40</int> </value>
++                </item>
++              </dictionary>
++            </value>
++        </item>
++      </dictionary>
++    </pickle>
++  </record>
++  <record id="2" aka="AAAAAAAAAAI=">
++    <pickle>
++      <tuple>
++        <global name="TALESMethod" module="Products.Formulator.TALESField"/>
++        <tuple/>
++      </tuple>
++    </pickle>
++    <pickle>
++      <dictionary>
++        <item>
++            <key> <string>_text</string> </key>
++            <value> <string>here/getRepositoryList</string> </value>
++        </item>
++      </dictionary>
++    </pickle>
++  </record>
++</ZopeData>
+Index: ERP5/Tool/TemplateTool.py
+===================================================================
+--- ERP5/Tool/TemplateTool.py	(revision 36706)
++++ ERP5/Tool/TemplateTool.py	(working copy)
+@@ -545,12 +545,17 @@
+     security.declareProtected(Permissions.ManagePortal, 'runUnitTestList')
+     def runUnitTestList(self, test_list=[],
+                         sql_connection_string='',
++                        repository_list=None,
+                         REQUEST=None, RESPONSE=None, **kwd):
+       """Runs Unit Tests related to this Business Template
+       """
++      if repository_list is None:
++        repository_list = []
+       # XXX: should check for file presence before trying to execute.
+       # XXX: should check if the unit test file is configured in the BT
++      site_configuration = getConfiguration()
+       from Products.ERP5Type.tests.runUnitTest import getUnitTestFile
++      import Products.ERP5
+       if RESPONSE is not None:
+         outfile = RESPONSE
+       elif REQUEST is not None:
+@@ -559,9 +564,41 @@
+         outfile =  StringIO()
+       if RESPONSE is not None:
+         RESPONSE.setHeader('Content-type', 'text/plain')
++      current_sys_path = sys.path
++      # add path with tests
++      current_sys_path.append(os.path.join(site_configuration.instancehome,
++        'tests'))
++
+       test_cmd_args = [sys.executable, getUnitTestFile()]
+       test_cmd_args += ['--erp5_sql_connection_string', sql_connection_string]
++      # pass currently used product path to test runner
++      products_path_list = site_configuration.products
++      # add products from Zope, as some sites are not providing it
++      zope_products_path = os.path.join(site_configuration.softwarehome, 'Products')
++      if zope_products_path not in products_path_list:
++        products_path_list.append(zope_products_path)
++      test_cmd_args += ['--products_path', ','.join(products_path_list)]
++      test_cmd_args += ['--sys_path', ','.join(current_sys_path)]
++      bt5_path_list = []
++      ## XXX-TODO: requires that asRepository works without security, maybe
++      ##           with special key?
++      # bt5_path_list.append(self.absolute_url() + '/asRepository/')
++      # add passed repository list
++      bt5_path_list.extend(repository_list)
++      # adding locally saved Business Templates, not perfect, but helps some
++      # people doing strict TTW development
++      bt5_path_list.append(site_configuration.clienthome)
++      test_cmd_args += ['--bt5_path', ','.join(bt5_path_list)]
+       test_cmd_args += test_list
++      # prepare message - intentionally without any additional formatting, as
++      # only developer will read it, and they will have to understand issues in
++      # case of test failures
++      invoke_command_message = 'Running tests using command: %r'% test_cmd_args
++      # as it is like using external interface, log what is send there
++      LOG('TemplateTool.runUnitTestList', INFO, invoke_command_message)
++      # inform developer how test are invoked
++      outfile.write(invoke_command_message + '\n')
++      outfile.flush()
+       process = subprocess.Popen(test_cmd_args,
+                                  stdout=subprocess.PIPE,
+                                  stderr=subprocess.STDOUT)

Added: erp5/release/candidate/release-patch/ERP5Type-tests-from-instance.patch
URL: http://svn.erp5.org/erp5/release/candidate/release-patch/ERP5Type-tests-from-instance.patch?rev=37176&view=auto
==============================================================================
--- erp5/release/candidate/release-patch/ERP5Type-tests-from-instance.patch (added)
+++ erp5/release/candidate/release-patch/ERP5Type-tests-from-instance.patch [utf8] Fri Jul 16 17:15:40 2010
@@ -0,0 +1,45 @@
+Index: ERP5Type/tests/runUnitTest.py
+===================================================================
+--- ERP5Type/tests/runUnitTest.py	(revision 36706)
++++ ERP5Type/tests/runUnitTest.py	(working copy)
+@@ -115,7 +115,10 @@
+                              Make ZServer listen on given host:port
+                              If used with --activity_node=, this can be a
+                              comma-separated list of addresses.
+-
++  --products_path=path,path  Comma-separated list of products paths locations
++                             which shall be used in test environment.
++  --sys_path=path,path       Comma-separated list of paths which will be used to
++                             extend sys.path
+ When no unit test is specified, only activities are processed.
+ """
+ 
+@@ -392,6 +395,8 @@
+   # On Zope 2.12, import_products() is called by ERP5TestCase before it is
+   # patched by the layer.setUp() call.
+   import OFS.Application
++  if os.environ.get('products_path'):
++    OFS.Application.Products.__path__ = os.environ.get('products_path').split(',')
+   import_products = OFS.Application.import_products
+   from Testing import ZopeTestCase # Zope 2.8: this will import custom_zodb.py
+   OFS.Application.import_products = import_products
+@@ -613,6 +618,8 @@
+         "zeo_client=",
+         "zeo_server=",
+         "zserver=",
++        "products_path=",
++        "sys_path="
+         ])
+   except getopt.GetoptError, msg:
+     usage(sys.stderr, msg)
+@@ -702,6 +709,10 @@
+       os.environ["zeo_server"] = arg
+     elif opt == "--zserver":
+       os.environ["zserver"] = arg
++    elif opt == "--products_path":
++      os.environ["products_path"] = arg
++    elif opt == "--sys_path":
++      sys.path.extend(arg.split(','))
+   
+   initializeInstanceHome(tests_framework_home, real_instance_home, instance_home)
+ 




More information about the Erp5-report mailing list