[Zope-CVS] CVS: Products/Zelenium - CHANGES.txt:1.32 zuite.py:1.19

Tres Seaver tseaver at palladion.com
Mon May 9 15:05:36 EDT 2005


Update of /cvs-repository/Products/Zelenium
In directory cvs.zope.org:/tmp/cvs-serv29020

Modified Files:
	CHANGES.txt zuite.py 
Log Message:
 - Allow suppression of Selenium files from archive.


=== Products/Zelenium/CHANGES.txt 1.31 => 1.32 ===
--- Products/Zelenium/CHANGES.txt:1.31	Mon May  9 14:51:29 2005
+++ Products/Zelenium/CHANGES.txt	Mon May  9 15:05:06 2005
@@ -4,6 +4,9 @@
 
     - CVS tag:  'Zelenium-0_6'
 
+    - Add ability to suppress inclusion of Selenium support files in
+      snapshot / download.
+
     - Add support for returning testcases from a mapped directory path,
       including recursion through subdirectories of that path.  Currently,
       the implementation has the following issues:


=== Products/Zelenium/zuite.py 1.18 => 1.19 ===
--- Products/Zelenium/zuite.py:1.18	Mon May  9 14:50:28 2005
+++ Products/Zelenium/zuite.py	Mon May  9 15:05:06 2005
@@ -219,13 +219,17 @@
 
 
     security.declareProtected(ManageSeleniumTestCases, 'manage_getZipFile')
-    def manage_getZipFile(self, archive_name=None, RESPONSE=None):
+    def manage_getZipFile( self
+                         , archive_name=None
+                         , include_selenium=True
+                         , RESPONSE=None
+                         ):
         """ Export the test suite as a zip file.
         """
         if archive_name is None or archive_name.strip() == '':
             archive_name = self.getZipFileName()
 
-        bits = self._getZipFile()
+        bits = self._getZipFile( include_selenium )
 
         if RESPONSE is None:
             return bits
@@ -238,13 +242,20 @@
 
 
     security.declareProtected(ManageSeleniumTestCases, 'manage_createSnapshot')
-    def manage_createSnapshot(self, archive_name=None, RESPONSE=None):
+    def manage_createSnapshot( self
+                             , archive_name=None
+                             , include_selenium=True
+                             , RESPONSE=None
+                             ):
         """ Save the test suite as a zip file *in the zuite*.
         """
         if archive_name is None or archive_name.strip() == '':
             archive_name = self.getZipFileName()
 
-        archive = File( archive_name, title='', file=self._getZipFile() )
+        archive = File( archive_name
+                      , title=''
+                      , file=self._getZipFile( include_selenium )
+                      )
         self._setObject( archive_name, archive )
 
         if RESPONSE is not None:
@@ -433,8 +444,8 @@
         return name
 
 
-    security.declarePrivate('_getZipFile')
-    def _getZipFile(self):
+    security.declarePrivate( '_getZipFile' )
+    def _getZipFile( self, include_selenium=True ):
         """ Generate a zip file containing both tests and scaffolding.
         """
         stream = StringIO.StringIO()
@@ -458,11 +469,9 @@
             info[ 'path' ] = path
             info[ 'url' ] = self._getFilename( info[ 'url' ] )
 
-        for info in test_cases:
-            #parent, filename = os.path.split( info[ 'path' ] )
-            #paths.setdefault( parent, [] ).append( filename )
-            elements = info[ 'path' ].split( os.path.sep )
+            elements = path.split( os.path.sep )
             _ensurePath( '', elements[ 0 ] )
+
             for i in range( 1, len( elements ) ):
                 prefix = '/'.join( elements[ : i ] )
                 _ensurePath( prefix, elements[ i ] )
@@ -470,9 +479,6 @@
         archive.writestr( 'testSuite.html'
                         , self.test_suite_html( test_cases=test_cases ) )
 
-        for k, v in _SUPPORT_FILES.items():
-            archive.writestr( k, v.manage_FTPget() )
-
         for pathname, filenames in paths.items():
 
             if pathname == '':
@@ -495,6 +501,12 @@
             archive.writestr( info[ 'path' ]
                             , body
                             )
+
+        if include_selenium:
+
+            for k, v in _SUPPORT_FILES.items():
+                archive.writestr( k, v.manage_FTPget() )
+
         archive.close()
         return stream.getvalue()
 



More information about the Zope-CVS mailing list