[Checkins] SVN: zope.file/trunk/ - Made tests compatible with ZODB 3.9.

Michael Howitz mh at gocept.com
Fri Apr 3 15:22:16 EDT 2009


Log message for revision 98848:
  - Made tests compatible with ZODB 3.9.
  - added coverage analysis tools to buildout.cfg
  - removed *-configure.zcml slug
  

Changed:
  U   zope.file/trunk/CHANGES.txt
  U   zope.file/trunk/buildout.cfg
  U   zope.file/trunk/src/zope/file/testing.py
  D   zope.file/trunk/src/zope/file/zope.file-configure.zcml

-=-
Modified: zope.file/trunk/CHANGES.txt
===================================================================
--- zope.file/trunk/CHANGES.txt	2009-04-03 16:59:46 UTC (rev 98847)
+++ zope.file/trunk/CHANGES.txt	2009-04-03 19:22:16 UTC (rev 98848)
@@ -8,12 +8,15 @@
 - Change package's mailing list address to zope-dev at zope.org instead
   of the retired one.
 
+- Made tests compatible with ZODB 3.9.
+
+
 0.4.0 (2009-01-31)
 ------------------
 
 - `openDetached` is now protected by zope.View instead of zope.ManageContent.
 
-- Use zope.container instead of zope.app.container.        
+- Use zope.container instead of zope.app.container.
 
 0.3.0 (2007-11-01)
 ------------------

Modified: zope.file/trunk/buildout.cfg
===================================================================
--- zope.file/trunk/buildout.cfg	2009-04-03 16:59:46 UTC (rev 98847)
+++ zope.file/trunk/buildout.cfg	2009-04-03 19:22:16 UTC (rev 98848)
@@ -1,7 +1,18 @@
 [buildout]
 develop = .
-parts = test
+parts = test coverage-test coverage-report
 
 [test]
 recipe = zc.recipe.testrunner
 eggs = zope.file [test]
+
+[coverage-test]
+recipe = zc.recipe.testrunner
+eggs = zope.file [test]
+defaults = ['--tests-pattern', '^f?tests$', '-v', '--coverage', '../../coverage']
+
+[coverage-report]
+recipe = zc.recipe.egg
+eggs = z3c.coverage
+scripts = coverage=coverage-report
+arguments = ('coverage', 'coverage/report')

Modified: zope.file/trunk/src/zope/file/testing.py
===================================================================
--- zope.file/trunk/src/zope/file/testing.py	2009-04-03 16:59:46 UTC (rev 98847)
+++ zope.file/trunk/src/zope/file/testing.py	2009-04-03 19:22:16 UTC (rev 98848)
@@ -26,12 +26,14 @@
 from zope.testing import doctest
 import zope.app.testing.functional
 from zope.app.component.hooks import setSite
+import ZODB.interfaces
 
 here = os.path.dirname(os.path.realpath(__file__))
 
 class FunctionalBlobTestSetup(zope.app.testing.functional.FunctionalTestSetup):
 
     temp_dir_name = None
+    direct_blob_support = False
 
     def setUp(self):
         """Prepares for a functional test case."""
@@ -39,10 +41,14 @@
         transaction.abort()
         self.db.close()
         storage = DemoStorage("Demo Storage", self.base_storage)
-        # make a dir
-        temp_dir_name = self.temp_dir_name = tempfile.mkdtemp()
-        # wrap storage with BlobStorage
-        storage = BlobStorage(temp_dir_name, storage)
+        if ZODB.interfaces.IBlobStorage.providedBy(storage):
+            # at least ZODB 3.9
+            self.direct_blob_support = True
+        else:
+            # make a dir
+            temp_dir_name = self.temp_dir_name = tempfile.mkdtemp()
+            # wrap storage with BlobStorage
+            storage = BlobStorage(temp_dir_name, storage)
         self.db = self.app.db = DB(storage)
         self.connection = None
 
@@ -53,8 +59,8 @@
             self.connection.close()
             self.connection = None
         self.db.close()
-        # del dir named '__blob_test__%s' % self.name
-        if self.temp_dir_name is not None:
+        if not self.direct_blob_support and self.temp_dir_name is not None:
+            # del dir named '__blob_test__%s' % self.name
             shutil.rmtree(self.temp_dir_name, True)
             self.temp_dir_name = None
         setSite(None)

Deleted: zope.file/trunk/src/zope/file/zope.file-configure.zcml
===================================================================
--- zope.file/trunk/src/zope/file/zope.file-configure.zcml	2009-04-03 16:59:46 UTC (rev 98847)
+++ zope.file/trunk/src/zope/file/zope.file-configure.zcml	2009-04-03 19:22:16 UTC (rev 98848)
@@ -1 +0,0 @@
-<include package="zope.file"/>
\ No newline at end of file



More information about the Checkins mailing list