[CMF-checkins] CVS: CMF/CMFSetup/tests - common.py:1.9 test_context.py:1.7

Tres Seaver tseaver at zope.com
Sun May 30 16:29:51 EDT 2004


Update of /cvs-repository/CMF/CMFSetup/tests
In directory cvs.zope.org:/tmp/cvs-serv18926/tests

Modified Files:
	common.py test_context.py 
Log Message:


  - context.py:

    o Ensure that archive members have current mtime.

  - typeinfo.py:

    o Force lookup of portal_types.getTypeInfo() to use a string key
      (the method fails if passed a Unicode equivalent!)


=== CMF/CMFSetup/tests/common.py 1.8 => 1.9 ===
--- CMF/CMFSetup/tests/common.py:1.8	Thu May 27 00:20:06 2004
+++ CMF/CMFSetup/tests/common.py	Sun May 30 16:29:50 2004
@@ -2,6 +2,7 @@
 """
 import os
 import shutil
+import time
 from tarfile import TarFile
 
 from Products.CMFCore.tests.base.testcase import SecurityRequestTest
@@ -91,7 +92,7 @@
 
 class TarballTester( DOMComparator ):
 
-    def _verifyTarballContents( self, fileish, toc_list ):
+    def _verifyTarballContents( self, fileish, toc_list, when=None ):
 
         fileish.seek( 0L )
         tarfile = TarFile.open( 'foo.tar.gz', fileobj=fileish, mode='r:gz' )
@@ -102,6 +103,10 @@
         self.assertEqual( len( items ), len( toc_list ) )
         for i in range( len( items ) ):
             self.assertEqual( items[ i ], toc_list[ i ] )
+
+        if when is not None:
+            for tarinfo in tarfile:
+                self.failIf( tarinfo.mtime < when )
 
     def _verifyTarballEntry( self, fileish, entry_name, data ):
 


=== CMF/CMFSetup/tests/test_context.py 1.6 => 1.7 ===
--- CMF/CMFSetup/tests/test_context.py:1.6	Mon May 24 18:43:51 2004
+++ CMF/CMFSetup/tests/test_context.py	Sun May 30 16:29:50 2004
@@ -5,6 +5,7 @@
 
 import unittest
 import os
+import time
 from StringIO import StringIO
 
 from OFS.Folder import Folder
@@ -347,6 +348,7 @@
     def test_writeDataFile_simple( self ):
 
         from string import printable
+        now = long( time.time() )
 
         site = DummySite( 'site' ).__of__( self.root )
         ctx = self._getTargetClass()( site )
@@ -355,7 +357,7 @@
 
         fileish = StringIO( ctx.getArchive() )
 
-        self._verifyTarballContents( fileish, [ 'foo.txt' ] )
+        self._verifyTarballContents( fileish, [ 'foo.txt' ], now )
         self._verifyTarballEntry( fileish, 'foo.txt', printable )
 
     def test_writeDataFile_multiple( self ):




More information about the CMF-checkins mailing list