[Erp5-report] r24206 - in /erp5/trunk/products/ERP5Type/tests: custom_zodb.py runUnitTest.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Oct 15 18:23:38 CEST 2008


Author: jerome
Date: Wed Oct 15 18:23:37 2008
New Revision: 24206

URL: http://svn.erp5.org?rev=24206&view=rev
Log:
Fix a dangerous bug happenning in runUnitTest --save :

Since r23751, unit tests instance have a folder for Extensions, and this folder
is cleaned up before --save. Before r23751, this folder was a symlink to the
real instance home's Extensions, so if you run --save on a test instance
initialized before this change, extensions from your real instance will be
removed.

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=24206&r1=24205&r2=24206&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/custom_zodb.py (original)
+++ erp5/trunk/products/ERP5Type/tests/custom_zodb.py Wed Oct 15 18:23:37 2008
@@ -31,6 +31,7 @@
   for dir in ('Constraint', 'Document', 'PropertySheet', 'Extensions'):
     full_path = os.path.join(instance_home, dir)
     if os.path.exists(full_path):
+      assert os.path.isdir(full_path)
       for f in glob.glob('%s/*' % full_path):
         os.unlink(f)
   if os.path.exists(new_data_fs_path):

Modified: erp5/trunk/products/ERP5Type/tests/runUnitTest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/runUnitTest.py?rev=24206&r1=24205&r2=24206&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/runUnitTest.py (original)
+++ erp5/trunk/products/ERP5Type/tests/runUnitTest.py Wed Oct 15 18:23:37 2008
@@ -77,6 +77,15 @@
                            instance_home):
   if not os.path.exists(instance_home):
     os.mkdir(instance_home)
+
+  # Before r23751, Extensions dir was initialized to be a symlink to real
+  # instance home Extensions folder, now it's initialized as an independant
+  # folder. If this test instance still have a symlink for Extensions, change
+  # it in a foler.
+  extensions_path = os.path.join(instance_home, 'Extensions')
+  if os.path.islink(extensions_path):
+    os.unlink(extensions_path)
+
   for d in ('Extensions', 'Constraint', 'Document', 'PropertySheet', 'bin', 'etc', 'tests', 'var', 'log'):
     path = os.path.join(instance_home, d)
     if not os.path.exists(path):




More information about the Erp5-report mailing list