[CMF-checkins] SVN: CMF/trunk/CMF - removed redundant
tests/common.py
Yvo Schubbe
y.2005- at wcm-solutions.de
Tue Nov 8 14:53:11 EST 2005
Log message for revision 39984:
- removed redundant tests/common.py
Changed:
U CMF/trunk/CMFActionIcons/tests/test_exportimport.py
D CMF/trunk/CMFSetup/tests/common.py
U CMF/trunk/CMFSetup/tests/test_actions.py
U CMF/trunk/CMFSetup/tests/test_cachingpolicymgr.py
U CMF/trunk/CMFSetup/tests/test_catalog.py
U CMF/trunk/CMFSetup/tests/test_contenttyperegistry.py
U CMF/trunk/CMFSetup/tests/test_cookieauth.py
U CMF/trunk/CMFSetup/tests/test_mailhost.py
U CMF/trunk/CMFSetup/tests/test_properties.py
U CMF/trunk/CMFSetup/tests/test_skins.py
U CMF/trunk/CMFSetup/tests/test_typeinfo.py
U CMF/trunk/CMFSetup/tests/test_utils.py
U CMF/trunk/CMFSetup/tests/test_workflow.py
-=-
Modified: CMF/trunk/CMFActionIcons/tests/test_exportimport.py
===================================================================
--- CMF/trunk/CMFActionIcons/tests/test_exportimport.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFActionIcons/tests/test_exportimport.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -14,15 +14,15 @@
$Id$
"""
+
import unittest
-#import Testing
+import Testing
+from Products.GenericSetup.tests.common import BaseRegistryTests
+from Products.GenericSetup.tests.common import DummyExportContext
+from Products.GenericSetup.tests.common import DummyImportContext
-from Products.CMFSetup.tests.common import BaseRegistryTests
-from Products.CMFSetup.tests.common import DummyExportContext
-from Products.CMFSetup.tests.common import DummyImportContext
-
class _ActionIconsToolSetup(BaseRegistryTests):
CATEGORY = 'testing'
Deleted: CMF/trunk/CMFSetup/tests/common.py
===================================================================
--- CMF/trunk/CMFSetup/tests/common.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFSetup/tests/common.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -1,189 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" CMFSetup product: unit test utilities.
-
-$Id$
-"""
-
-import os
-import shutil
-from tarfile import TarFile
-
-from Products.CMFCore.tests.base.testcase import SecurityRequestTest
-
-
-class DOMComparator:
-
- def _compareDOM( self, found_text, expected_text, debug=False ):
-
- found_lines = [ x.strip() for x in found_text.splitlines() ]
- found_text = '\n'.join( filter( None, found_lines ) )
-
- expected_lines = [ x.strip() for x in expected_text.splitlines() ]
- expected_text = '\n'.join( filter( None, expected_lines ) )
-
- from xml.dom.minidom import parseString
- found = parseString( found_text )
- expected = parseString( expected_text )
- fxml = found.toxml()
- exml = expected.toxml()
-
- if fxml != exml:
-
- if debug:
- zipped = zip( fxml, exml )
- diff = [ ( i, zipped[i][0], zipped[i][1] )
- for i in range( len( zipped ) )
- if zipped[i][0] != zipped[i][1]
- ]
- import pdb; pdb.set_trace()
-
- print 'Found:'
- print fxml
- print
- print 'Expected:'
- print exml
- print
-
- self.assertEqual( found.toxml(), expected.toxml() )
-
-class BaseRegistryTests( SecurityRequestTest, DOMComparator ):
-
- def _makeOne( self, *args, **kw ):
-
- # Derived classes must implement _getTargetClass
- return self._getTargetClass()( *args, **kw )
-
-def _clearTestDirectory( root_path ):
-
- if os.path.exists( root_path ):
- shutil.rmtree( root_path )
-
-def _makeTestFile( filename, root_path, contents ):
-
- path, filename = os.path.split( filename )
-
- subdir = os.path.join( root_path, path )
-
- if not os.path.exists( subdir ):
- os.makedirs( subdir )
-
- fqpath = os.path.join( subdir, filename )
-
- file = open( fqpath, 'wb' )
- file.write( contents )
- file.close()
- return fqpath
-
-class FilesystemTestBase( SecurityRequestTest ):
-
- def _makeOne( self, *args, **kw ):
-
- return self._getTargetClass()( *args, **kw )
-
- def setUp( self ):
-
- SecurityRequestTest.setUp( self )
- self._clearTempDir()
-
- def tearDown( self ):
-
- self._clearTempDir()
- SecurityRequestTest.tearDown( self )
-
- def _clearTempDir( self ):
-
- _clearTestDirectory( self._PROFILE_PATH )
-
- def _makeFile( self, filename, contents ):
-
- return _makeTestFile( filename, self._PROFILE_PATH, contents )
-
-
-class TarballTester( DOMComparator ):
-
- def _verifyTarballContents( self, fileish, toc_list, when=None ):
-
- fileish.seek( 0L )
- tarfile = TarFile.open( 'foo.tar.gz', fileobj=fileish, mode='r:gz' )
- items = tarfile.getnames()
- items.sort()
- toc_list.sort()
-
- 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 ):
-
- fileish.seek( 0L )
- tarfile = TarFile.open( 'foo.tar.gz', fileobj=fileish, mode='r:gz' )
- extract = tarfile.extractfile( entry_name )
- found = extract.read()
- self.assertEqual( found, data )
-
- def _verifyTarballEntryXML( self, fileish, entry_name, data ):
-
- fileish.seek( 0L )
- tarfile = TarFile.open( 'foo.tar.gz', fileobj=fileish, mode='r:gz' )
- extract = tarfile.extractfile( entry_name )
- found = extract.read()
- self._compareDOM( found, data )
-
-
-class DummyExportContext:
-
- def __init__( self, site ):
- self._site = site
- self._wrote = []
-
- def getSite( self ):
- return self._site
-
- def writeDataFile( self, filename, text, content_type, subdir=None ):
- if subdir is not None:
- filename = '%s/%s' % ( subdir, filename )
- self._wrote.append( ( filename, text, content_type ) )
-
-class DummyImportContext:
-
- def __init__( self, site, purge=True, encoding=None ):
- self._site = site
- self._purge = purge
- self._encoding = encoding
- self._files = {}
-
- def getSite( self ):
- return self._site
-
- def getEncoding( self ):
- return self._encoding
-
- def readDataFile( self, filename, subdir=None ):
-
- if subdir is not None:
- filename = '/'.join( (subdir, filename) )
-
- return self._files.get( filename )
-
- def shouldPurge( self ):
-
- return self._purge
-
-def dummy_handler( context ):
-
- pass
Modified: CMF/trunk/CMFSetup/tests/test_actions.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_actions.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFSetup/tests/test_actions.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -33,12 +33,11 @@
import ActionProvider as IActionProvider
from Products.CMFCore.interfaces import IActionsTool
from Products.CMFCore.tests.base.testcase import PlacelessSetup
+from Products.GenericSetup.tests.common import BaseRegistryTests
+from Products.GenericSetup.tests.common import DummyExportContext
+from Products.GenericSetup.tests.common import DummyImportContext
-from common import BaseRegistryTests
-from common import DummyExportContext
-from common import DummyImportContext
-
class DummyTool( OrderedFolder, ActionProviderBase ):
__implements__ = ( IActionProvider, )
Modified: CMF/trunk/CMFSetup/tests/test_cachingpolicymgr.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_cachingpolicymgr.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFSetup/tests/test_cachingpolicymgr.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -14,15 +14,15 @@
$Id$
"""
+
import unittest
-#import Testing
+import Testing
+from Products.GenericSetup.tests.common import BaseRegistryTests
+from Products.GenericSetup.tests.common import DummyExportContext
+from Products.GenericSetup.tests.common import DummyImportContext
-from common import BaseRegistryTests
-from common import DummyExportContext
-from common import DummyImportContext
-
class _CachingPolicyManagerSetup(BaseRegistryTests):
POLICY_ID = 'policy_id'
Modified: CMF/trunk/CMFSetup/tests/test_catalog.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_catalog.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFSetup/tests/test_catalog.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -28,12 +28,11 @@
from Products.CMFCore.CatalogTool import CatalogTool
from Products.CMFCore.tests.base.testcase import PlacelessSetup
+from Products.GenericSetup.tests.common import BaseRegistryTests
+from Products.GenericSetup.tests.common import DummyExportContext
+from Products.GenericSetup.tests.common import DummyImportContext
-from common import BaseRegistryTests
-from common import DummyExportContext
-from common import DummyImportContext
-
class _extra:
pass
Modified: CMF/trunk/CMFSetup/tests/test_contenttyperegistry.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_contenttyperegistry.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFSetup/tests/test_contenttyperegistry.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -14,14 +14,14 @@
$Id$
"""
+
import unittest
-#import Testing
+import Testing
+from Products.GenericSetup.tests.common import BaseRegistryTests
+from Products.GenericSetup.tests.common import DummyExportContext
+from Products.GenericSetup.tests.common import DummyImportContext
-from common import BaseRegistryTests
-from common import DummyExportContext
-from common import DummyImportContext
-
_TEST_PREDICATES = (
('plain_text', 'major_minor', ('text', 'plain,javascript'), 'File'),
('stylesheets', 'extension', ('css,xsl,xslt',), 'Text File'),
Modified: CMF/trunk/CMFSetup/tests/test_cookieauth.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_cookieauth.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFSetup/tests/test_cookieauth.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -24,12 +24,11 @@
from Products.CMFCore.CookieCrumbler import CookieCrumbler
from Products.CMFCore.tests.base.testcase import PlacelessSetup
+from Products.GenericSetup.tests.common import BaseRegistryTests
+from Products.GenericSetup.tests.common import DummyExportContext
+from Products.GenericSetup.tests.common import DummyImportContext
-from common import BaseRegistryTests
-from common import DummyExportContext
-from common import DummyImportContext
-
class _CookieCrumblerSetup(PlacelessSetup, BaseRegistryTests):
def _initSite(self, use_changed=False):
Modified: CMF/trunk/CMFSetup/tests/test_mailhost.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_mailhost.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFSetup/tests/test_mailhost.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -22,13 +22,13 @@
from OFS.Folder import Folder
from Products.Five import zcml
from Products.MailHost.MailHost import MailHost
+
from Products.CMFCore.tests.base.testcase import PlacelessSetup
+from Products.GenericSetup.tests.common import BaseRegistryTests
+from Products.GenericSetup.tests.common import DummyExportContext
+from Products.GenericSetup.tests.common import DummyImportContext
-from common import BaseRegistryTests
-from common import DummyExportContext
-from common import DummyImportContext
-
class _MailHostSetup(PlacelessSetup, BaseRegistryTests):
def _initSite(self, use_changed=False):
Modified: CMF/trunk/CMFSetup/tests/test_properties.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_properties.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFSetup/tests/test_properties.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -23,9 +23,9 @@
from Products.CMFCore.PortalObject import PortalObjectBase
from Products.CMFCore.tests.base.testcase import PlacelessSetup
-from common import BaseRegistryTests
-from common import DummyExportContext
-from common import DummyImportContext
+from Products.GenericSetup.tests.common import BaseRegistryTests
+from Products.GenericSetup.tests.common import DummyExportContext
+from Products.GenericSetup.tests.common import DummyImportContext
_EMPTY_EXPORT = """\
Modified: CMF/trunk/CMFSetup/tests/test_skins.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_skins.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFSetup/tests/test_skins.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -28,12 +28,11 @@
from Products.CMFCore import DirectoryView
from Products.CMFCore.utils import expandpath
from Products.CMFCore.utils import minimalpath
+from Products.GenericSetup.tests.common import BaseRegistryTests
+from Products.GenericSetup.tests.common import DOMComparator
+from Products.GenericSetup.tests.common import DummyExportContext
+from Products.GenericSetup.tests.common import DummyImportContext
-from common import BaseRegistryTests
-from common import DOMComparator
-from common import DummyExportContext
-from common import DummyImportContext
-
_TESTS_PATH = os.path.split( __file__ )[ 0 ]
Modified: CMF/trunk/CMFSetup/tests/test_typeinfo.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_typeinfo.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFSetup/tests/test_typeinfo.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -31,12 +31,11 @@
from Products.CMFCore.TypesTool import FactoryTypeInformation
from Products.CMFCore.TypesTool import ScriptableTypeInformation
from Products.CMFCore.TypesTool import TypesTool
+from Products.GenericSetup.tests.common import BaseRegistryTests
+from Products.GenericSetup.tests.common import DummyExportContext
+from Products.GenericSetup.tests.common import DummyImportContext
-from common import BaseRegistryTests
-from common import DummyExportContext
-from common import DummyImportContext
-
class _TypeInfoSetup(PlacelessSetup, BaseRegistryTests):
def _initSite(self, foo=0):
Modified: CMF/trunk/CMFSetup/tests/test_utils.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_utils.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFSetup/tests/test_utils.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -24,10 +24,9 @@
from OFS.Folder import Folder
from Products.CMFCore.tests.base.testcase import WarningInterceptor
+from Products.GenericSetup.tests.common import BaseRegistryTests
-from common import BaseRegistryTests
-
_NORMAL_PROPERTY_NODES = """\
<property name="foo_boolean" type="boolean">True</property>
<property name="foo_date" type="date">2000/01/01</property>
Modified: CMF/trunk/CMFSetup/tests/test_workflow.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_workflow.py 2005-11-08 18:45:42 UTC (rev 39983)
+++ CMF/trunk/CMFSetup/tests/test_workflow.py 2005-11-08 19:53:11 UTC (rev 39984)
@@ -27,12 +27,11 @@
from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION
from Products.DCWorkflow.Transitions import TRIGGER_AUTOMATIC
+from Products.GenericSetup.tests.common import BaseRegistryTests
+from Products.GenericSetup.tests.common import DummyExportContext
+from Products.GenericSetup.tests.common import DummyImportContext
-from common import BaseRegistryTests
-from common import DummyExportContext
-from common import DummyImportContext
-
class DummyWorkflowTool( Folder ):
def __init__( self, id='portal_workflow' ):
More information about the CMF-checkins
mailing list