[Erp5-report] r35098 jerome - /erp5/trunk/products/ERP5Type/tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri May 7 10:34:06 CEST 2010


Author: jerome
Date: Fri May  7 10:34:00 2010
New Revision: 35098

URL: http://svn.erp5.org?rev=35098&view=rev
Log:
When running functional tests, custom_zodb.py is in the instance home, so
from there we cannot import runUnitTest using relative import, so import it from
its full path instead, and to prevent reloading runUnitTest (which has some
import side effects) in such case, we insert it in sys module.
Original patch from jm


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

Modified: erp5/trunk/products/ERP5Type/tests/custom_zodb.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/custom_zodb.py?rev=35098&r1=35097&r2=35098&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/custom_zodb.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/custom_zodb.py [utf8] Fri May  7 10:34:00 2010
@@ -6,7 +6,7 @@
 from ZODB.DemoStorage import DemoStorage
 from ZODB.FileStorage import FileStorage
 from Products.ERP5Type.tests.utils import getMySQLArguments
-from runUnitTest import instance_home, static_dir_list
+from Products.ERP5Type.tests.runUnitTest import instance_home, static_dir_list
 
 def _print(message):
   sys.stderr.write(message + "\n")

Modified: erp5/trunk/products/ERP5Type/tests/runUnitTest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/runUnitTest.py?rev=35098&r1=35097&r2=35098&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] Fri May  7 10:34:00 2010
@@ -105,6 +105,13 @@
                              otherwise) is created for this purpose.
 
 """
+
+# This script is usually executed directly, and is also imported using its full
+# doted name from other locations, such as custom_zodb.py . To prevent
+# reloading this module in such case, we store it in sys.modules under that
+# name.
+sys.modules['Products.ERP5Type.tests.runUnitTest'] = sys.modules[__name__]
+
 
 static_dir_list = 'Constraint', 'Document', 'Extensions', 'PropertySheet'
 




More information about the Erp5-report mailing list