[Erp5-report] r35418 jm - /erp5/trunk/products/ERP5Type/tests/runUnitTest.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue May 18 11:04:21 CEST 2010


Author: jm
Date: Tue May 18 11:04:10 2010
New Revision: 35418

URL: http://svn.erp5.org?rev=35418&view=rev
Log:
Import ERP5TypeTestCase before execution of layer.ZopeLite.setUp

Modified:
    erp5/trunk/products/ERP5Type/tests/runUnitTest.py

Modified: erp5/trunk/products/ERP5Type/tests/runUnitTest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/runUnitTest.py?rev=35418&r1=35417&r2=35418&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] Tue May 18 11:04:10 2010
@@ -376,7 +376,7 @@
   # patched by the layer.setUp() call.
   import OFS.Application
   import_products = OFS.Application.import_products
-  from Testing import ZopeTestCase # This will import custom_zodb.py
+  from Testing import ZopeTestCase # Zope 2.8: this will import custom_zodb.py
   OFS.Application.import_products = import_products
 
   try:
@@ -436,6 +436,12 @@
 
   # change current directory to the test home, to create zLOG.log in this dir.
   os.chdir(tests_home)
+
+  # import ERP5TypeTestCase before calling layer.ZopeLite.setUp
+  # XXX What if the unit test itself uses 'onsetup' ? We should be able to call
+  #     remaining 'onsetup' hooks just before executing the test suite.
+  from Products.ERP5Type.tests.ERP5TypeTestCase import \
+      ProcessingNodeTestCase, ZEOServerTestCase, dummy_setUp, dummy_tearDown
   try:
     from Testing.ZopeTestCase import layer
   except ImportError:
@@ -447,7 +453,10 @@
     # FIXME: We should start using Zope layers. Our setup will probably
     # be faster and we could drop most of this code we currently maintain
     # ourselves
-    layer.ZopeLite.setUp()
+    layer.ZopeLite.setUp() # Zope 2.12: this will import custom_zodb.py
+    def assertFalse():
+      assert False
+    layer.onsetup = assertFalse
 
   TestRunner = backportUnittest.TextTestRunner
 
@@ -455,8 +464,6 @@
   from ZEO.ClientStorage import ClientStorage
   from Zope2.custom_zodb import \
       save_mysql, zeo_server_pid, zeo_client_pid_list, Storage
-  from Products.ERP5Type.tests.ERP5TypeTestCase import \
-      ProcessingNodeTestCase, ZEOServerTestCase, dummy_setUp, dummy_tearDown
   def shutdown(signum, frame, signum_set=set()):
     Lifetime.shutdown(0)
     signum_set.add(signum)




More information about the Erp5-report mailing list