[CMF-checkins] SVN: CMF/trunk/ - removed Zope2.startup() (all CMF
tests use now ZopeTestCase.ZopeLite)
Yvo Schubbe
y.2006_ at wcm-solutions.de
Mon Jun 5 12:30:20 EDT 2006
Log message for revision 68496:
- removed Zope2.startup() (all CMF tests use now ZopeTestCase.ZopeLite)
- added WritableFSDVTest (most FSDVTests don't need a writable copy)
- related cleanup
This makes running ZopeTestCase tests and CMF base.testcase tests side by side more robust.
Running all CMF unit tests is now more than 20% faster on my machine.
Changed:
U CMF/trunk/CMFActionIcons/tests/test_ActionIconsTool.py
U CMF/trunk/CMFCalendar/tests/test_Calendar.py
U CMF/trunk/CMFCore/exportimport/tests/test_catalog.py
U CMF/trunk/CMFCore/exportimport/tests/test_skins.py
U CMF/trunk/CMFCore/tests/base/testcase.py
U CMF/trunk/CMFCore/tests/test_ActionProviderBase.py
U CMF/trunk/CMFCore/tests/test_ActionsTool.py
U CMF/trunk/CMFCore/tests/test_CMFBTreeFolder.py
U CMF/trunk/CMFCore/tests/test_CMFCatalogAware.py
U CMF/trunk/CMFCore/tests/test_ContentTypeRegistry.py
U CMF/trunk/CMFCore/tests/test_DirectoryView.py
U CMF/trunk/CMFCore/tests/test_DiscussionTool.py
U CMF/trunk/CMFCore/tests/test_DynamicType.py
U CMF/trunk/CMFCore/tests/test_Expression.py
U CMF/trunk/CMFCore/tests/test_FSDTMLMethod.py
U CMF/trunk/CMFCore/tests/test_FSFile.py
U CMF/trunk/CMFCore/tests/test_FSImage.py
U CMF/trunk/CMFCore/tests/test_FSMetadata.py
U CMF/trunk/CMFCore/tests/test_FSPageTemplate.py
U CMF/trunk/CMFCore/tests/test_FSPropertiesObject.py
U CMF/trunk/CMFCore/tests/test_FSPythonScript.py
U CMF/trunk/CMFCore/tests/test_FSSecurity.py
U CMF/trunk/CMFCore/tests/test_FSZSQLMethod.py
U CMF/trunk/CMFCore/tests/test_MemberDataTool.py
U CMF/trunk/CMFCore/tests/test_MembershipTool.py
U CMF/trunk/CMFCore/tests/test_PortalFolder.py
U CMF/trunk/CMFCore/tests/test_RegistrationTool.py
U CMF/trunk/CMFCore/tests/test_SkinsTool.py
U CMF/trunk/CMFCore/tests/test_URLTool.py
U CMF/trunk/CMFCore/tests/test_UndoTool.py
U CMF/trunk/CMFCore/tests/test_fiveactionstool.py
U CMF/trunk/CMFDefault/tests/test_DiscussionReply.py
U CMF/trunk/CMFDefault/tests/test_DiscussionTool.py
U CMF/trunk/CMFDefault/tests/test_DublinCore.py
U CMF/trunk/CMFDefault/tests/test_Image.py
U CMF/trunk/CMFDefault/tests/test_MembershipTool.py
U CMF/trunk/CMFDefault/tests/test_MetadataTool.py
U CMF/trunk/CMFDefault/tests/test_Portal.py
U CMF/trunk/CMFDefault/tests/test_PropertiesTool.py
U CMF/trunk/CMFDefault/tests/test_RegistrationTool.py
U CMF/trunk/CMFDefault/tests/test_join.py
U CMF/trunk/CMFDefault/tests/test_utils.py
U CMF/trunk/CMFTopic/tests/test_DateC.py
U CMF/trunk/CMFTopic/tests/test_ListC.py
U CMF/trunk/CMFTopic/tests/test_SIC.py
U CMF/trunk/CMFTopic/tests/test_SSC.py
U CMF/trunk/CMFTopic/tests/test_SortC.py
U CMF/trunk/CMFTopic/tests/test_Topic.py
U CMF/trunk/DCWorkflow/tests/test_exportimport.py
U CMF/trunk/DCWorkflow/tests/test_roles.py
-=-
Modified: CMF/trunk/CMFActionIcons/tests/test_ActionIconsTool.py
===================================================================
--- CMF/trunk/CMFActionIcons/tests/test_ActionIconsTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFActionIcons/tests/test_ActionIconsTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -17,11 +17,9 @@
import unittest
import Testing
-import Zope2
-Zope2.startup()
-class ActionIconToolTests( unittest.TestCase ):
+class ActionIconToolTests(unittest.TestCase):
def _makeOne( self, *args, **kw ):
Modified: CMF/trunk/CMFCalendar/tests/test_Calendar.py
===================================================================
--- CMF/trunk/CMFCalendar/tests/test_Calendar.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCalendar/tests/test_Calendar.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -16,9 +16,13 @@
"""
import unittest
-import Testing
-import Zope2
-Zope2.startup()
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('ZCTextIndex', 1)
+ZopeTestCase.installProduct('Five', 1)
+ZopeTestCase.installProduct('CMFCore', 1)
+ZopeTestCase.installProduct('CMFDefault', 1)
+ZopeTestCase.installProduct('CMFCalendar', 1)
+ZopeTestCase.utils.setupCoreSessions()
import locale
@@ -29,29 +33,29 @@
from AccessControl.User import UnrestrictedUser
from DateTime import DateTime
from Products.Five import zcml
-from Products.TemporaryFolder.TemporaryFolder import MountedTemporaryFolder
-from Products.Transience.Transience import TransientObjectContainer
-from Testing.makerequest import makerequest
from zope.testing.cleanup import cleanUp
from Products.CMFCore import Skinnable
+from Products.CMFCore.tests.base.testcase import setUpEvents
+from Products.CMFCore.tests.base.testcase import setUpGenericSetup
+from Products.CMFCore.tests.base.testcase import setUpTraversing
class CalendarTests(unittest.TestCase):
- def _makeOne(self, *args, **kw):
+ def _getTargetClass(self):
from Products.CMFCalendar.CalendarTool import CalendarTool
- ctool = CalendarTool(*args, **kw)
- ctool.firstweekday = 6
- return ctool
+ return CalendarTool
+ def _makeOne(self, *args, **kw):
+ return self._getTargetClass()(*args, **kw)
+
def test_z3interfaces(self):
from zope.interface.verify import verifyClass
from Products.CMFCalendar.interfaces import ICalendarTool
- from Products.CMFCalendar.CalendarTool import CalendarTool
- verifyClass(ICalendarTool, CalendarTool)
+ verifyClass(ICalendarTool, self._getTargetClass())
def test_new(self):
ctool = self._makeOne()
@@ -87,6 +91,7 @@
def test_firstweekday(self):
ctool = self._makeOne()
+ ctool.firstweekday = 6
self.assertEqual(ctool.getFirstWeekDay(), 6)
# Try setting it to invalid values, the setting should not stick
@@ -113,9 +118,13 @@
class CalendarRequestTests(unittest.TestCase):
def setUp(self):
- zcml.load_config('meta.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.GenericSetup)
+ import Products.DCWorkflow
+
+ setUpEvents()
+ setUpTraversing()
+ setUpGenericSetup()
+ zcml.load_config('permissions.zcml', Products.Five)
+ zcml.load_config('configure.zcml', Products.Five.skin)
zcml.load_config('configure.zcml', Products.CMFCalendar)
zcml.load_config('configure.zcml', Products.CMFCore)
zcml.load_config('configure.zcml', Products.CMFDefault)
@@ -123,7 +132,7 @@
self._oldSkindata = Skinnable.SKINDATA.copy()
transaction.begin()
- app = self.app = makerequest(Zope2.app())
+ app = self.app = ZopeTestCase.utils.makerequest(ZopeTestCase.app())
# Log in as a god :-)
newSecurityManager( None, UnrestrictedUser('god', 'god', ['Manager'], '') )
@@ -134,20 +143,13 @@
self.Tool = app.CalendarTest.portal_calendar
# sessioning setup
- if getattr(app, 'temp_folder', None) is None:
- temp_folder = MountedTemporaryFolder('temp_folder')
- app._setObject('temp_folder', temp_folder)
- if getattr(app.temp_folder, 'session_data', None) is None:
- session_data = TransientObjectContainer('session_data')
- app.temp_folder._setObject('session_data', session_data)
app.REQUEST.set_lazy( 'SESSION',
app.session_data_manager.getSessionData )
def tearDown(self):
- self.app.REQUEST.close()
noSecurityManager()
transaction.abort()
- self.app._p_jar.close()
+ ZopeTestCase.close(self.app)
Skinnable.SKINDATA = self._oldSkindata
cleanUp()
Modified: CMF/trunk/CMFCore/exportimport/tests/test_catalog.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_catalog.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/exportimport/tests/test_catalog.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -16,9 +16,8 @@
"""
import unittest
-import Testing
-import Zope2
-Zope2.startup()
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('ZCTextIndex', 1)
import Products
from OFS.Folder import Folder
@@ -104,6 +103,10 @@
return site
def setUp(self):
+ import Products.GenericSetup.PluginIndexes
+ import Products.GenericSetup.ZCatalog
+ import Products.GenericSetup.ZCTextIndex
+
BaseRegistryTests.setUp(self)
zcml.load_config('meta.zcml', Products.Five)
zcml.load_config('configure.zcml',
Modified: CMF/trunk/CMFCore/exportimport/tests/test_skins.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_skins.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/exportimport/tests/test_skins.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -16,9 +16,8 @@
"""
import unittest
-import Testing
-import Zope2
-Zope2.startup()
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('CMFCore', 1)
import os
Modified: CMF/trunk/CMFCore/tests/base/testcase.py
===================================================================
--- CMF/trunk/CMFCore/tests/base/testcase.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/base/testcase.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -1,6 +1,5 @@
-from unittest import TestCase
-import Zope2
-Zope2.startup()
+import unittest
+from Testing import ZopeTestCase
import logging
import sys
@@ -16,7 +15,6 @@
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
from Products.Five import zcml
-from Testing.makerequest import makerequest
from dummy import DummyFolder
from security import AnonymousUser
@@ -29,6 +27,8 @@
xmlns:five="http://namespaces.zope.org/five"
>
+ <include package="zope.app.traversing"/>
+
<adapter
for="*"
factory="Products.Five.traversable.FiveTraversable"
@@ -66,7 +66,13 @@
# Now, register the CMF-specific handler
zcml.load_config('event.zcml', Products.CMFCore)
+def setUpGenericSetup():
+ import Products
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml', Products.GenericSetup)
+
+
class LogInterceptor:
logged = None
@@ -126,56 +132,53 @@
sys.stderr = self._old_stderr
-class TransactionalTest( TestCase ):
+class TransactionalTest(unittest.TestCase):
def setUp( self ):
transaction.begin()
- self.connection = Zope2.DB.open()
- self.root = self.connection.root()[ 'Application' ]
+ self.app = self.root = ZopeTestCase.app()
def tearDown( self ):
transaction.abort()
- self.connection.close()
+ ZopeTestCase.close(self.app)
-class RequestTest( TransactionalTest ):
+class RequestTest(TransactionalTest):
def setUp(self):
TransactionalTest.setUp(self)
- root = self.root = makerequest(self.root)
- self.REQUEST = root.REQUEST
- self.RESPONSE = root.REQUEST.RESPONSE
+ self.app = self.root = ZopeTestCase.utils.makerequest(self.app)
+ self.REQUEST = self.app.REQUEST
+ self.RESPONSE = self.app.REQUEST.RESPONSE
def tearDown(self):
self.REQUEST.close()
TransactionalTest.tearDown(self)
-class SecurityTest( TestCase ):
+class SecurityTest(unittest.TestCase):
def setUp(self):
transaction.begin()
self._policy = PermissiveSecurityPolicy()
self._oldPolicy = setSecurityPolicy(self._policy)
- self.connection = Zope2.DB.open()
- self.root = self.connection.root()[ 'Application' ]
- newSecurityManager( None, AnonymousUser().__of__( self.root ) )
+ self.app = self.root = ZopeTestCase.app()
+ newSecurityManager(None, AnonymousUser().__of__(self.app.acl_users))
def tearDown( self ):
transaction.abort()
- self.connection.close()
+ ZopeTestCase.close(self.app)
noSecurityManager()
setSecurityPolicy(self._oldPolicy)
-class SecurityRequestTest( SecurityTest ):
+class SecurityRequestTest(SecurityTest):
def setUp(self):
SecurityTest.setUp(self)
- self.root = makerequest(self.root)
+ self.app = self.root = ZopeTestCase.utils.makerequest(self.app)
def tearDown(self):
- self.root.REQUEST.close()
SecurityTest.tearDown(self)
try:
@@ -190,11 +193,9 @@
_prefix = abspath(join(_prefix,'..'))
-class FSDVTest( TestCase, WarningInterceptor ):
- # Base class for FSDV test, creates a fake skin
- # copy that can be edited.
+class FSDVTest(unittest.TestCase, WarningInterceptor):
- _sourceprefix = _prefix
+ tempname = _sourceprefix = _prefix
_skinname = 'fake_skins'
_layername = 'fake_skin'
@@ -209,6 +210,18 @@
ob = self.ob = DummyFolder()
addDirectoryViews(ob, self._skinname, self.tempname)
+ def setUp(self):
+ # store the skin path name
+ self.skin_path_name = join(self.tempname,self._skinname,self._layername)
+
+ def tearDown(self):
+ self._free_warning_output()
+
+
+class WritableFSDVTest(FSDVTest):
+ # Base class for FSDV test, creates a fake skin
+ # copy that can be edited.
+
def _writeFile(self, filename, stuff):
# write some stuff to a file on disk
# make sure the file's modification time has changed
@@ -278,11 +291,10 @@
for root, dirs, files in walk(self.tempname):
for name in files:
chmod(join(root, name), S_IREAD+S_IWRITE)
- # store the skin path name
- self.skin_path_name = join(self.tempname,self._skinname,self._layername)
+ FSDVTest.setUp(self)
def tearDown(self):
- self._free_warning_output()
+ FSDVTest.tearDown(self)
# kill the copy
try:
rmtree(self.tempname)
Modified: CMF/trunk/CMFCore/tests/test_ActionProviderBase.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_ActionProviderBase.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_ActionProviderBase.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,10 +15,8 @@
$Id$
"""
-from unittest import TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
@@ -286,9 +284,9 @@
def test_suite():
- return TestSuite((
- makeSuite(ActionProviderBaseTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(ActionProviderBaseTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_ActionsTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_ActionsTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_ActionsTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -136,7 +136,7 @@
'user': [],
'object': [],
'folder': [{'id': 'folderContents',
- 'url': 'http://foo/folder_contents',
+ 'url': 'http://nohost/folder_contents',
'title': 'Folder contents',
'description': '',
'visible': True,
Modified: CMF/trunk/CMFCore/tests/test_CMFBTreeFolder.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_CMFBTreeFolder.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_CMFBTreeFolder.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -17,8 +17,6 @@
import unittest
import Testing
-import Zope2
-Zope2.startup()
from Products.CMFCore.testing import ConformsToFolder
@@ -37,13 +35,14 @@
empty = self._makeOne('test')
self.assertEqual( len( empty.objectIds() ), 0 )
- def test___module_aliases__( self ):
- from Products.BTreeFolder2.CMFBTreeFolder \
- import CMFBTreeFolder as BBB
+# this test doesn't work with ZopeTestCase.ZopeLite.installProduct
+## def test___module_aliases__( self ):
+## from Products.BTreeFolder2.CMFBTreeFolder \
+## import CMFBTreeFolder as BBB
+##
+## self.failUnless( BBB is self._getTargetClass() )
- self.failUnless( BBB is self._getTargetClass() )
-
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(CMFBTreeFolderTests),
Modified: CMF/trunk/CMFCore/tests/test_CMFCatalogAware.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_CMFCatalogAware.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_CMFCatalogAware.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -31,7 +31,7 @@
from Products.CMFCore.tests.test_PortalFolder import _AllowedUser
from Products.CMFCore.tests.test_PortalFolder import _SensitiveSecurityPolicy
from Products.CMFCore.tests.base.testcase import LogInterceptor
-from Products.CMFCore.tests.base.testcase import SecurityTest
+from Products.CMFCore.tests.base.testcase import SecurityRequestTest
from Products.CMFCore.tests.base.testcase import setUpEvents
CMF_SECURITY_INDEXES = CMFCatalogAware._cmf_security_indexes
@@ -216,45 +216,27 @@
# FIXME: more tests needed
-class CMFCatalogAware_CopySupport_Tests(SecurityTest):
+class CMFCatalogAware_CopySupport_Tests(SecurityRequestTest):
def setUp(self):
- SecurityTest.setUp(self)
+ SecurityRequestTest.setUp(self)
setUpEvents()
def tearDown(self):
- SecurityTest.tearDown(self)
+ SecurityRequestTest.tearDown(self)
cleanUp()
def _makeSite(self):
- import cStringIO
- from OFS.Application import Application
- from OFS.tests.testCopySupport import makeConnection
- from Testing.makerequest import makerequest
+ self.app._setObject('site', SimpleFolder('site'))
+ site = self.app._getOb('site')
+ site._setObject('portal_catalog', DummyCatalog())
+ site._setObject('portal_workflow', DummyWorkflowTool())
+ # Hack, we need a _p_mtime for the file, so we make sure that it
+ # has one. We use a subtransaction, which means we can rollback
+ # later and pretend we didn't touch the ZODB.
+ transaction.savepoint(optimistic=True)
+ return site
- self.connection = makeConnection()
- try:
- r = self.connection.root()
- a = Application()
- r['Application'] = a
- self.root = a
- responseOut = self.responseOut = cStringIO.StringIO()
- self.app = makerequest(self.root, stdout=responseOut)
- site = SimpleFolder('site')
- self.app._setObject('site', site)
- site = self.app._getOb('site')
- site._setObject('portal_catalog', DummyCatalog())
- site._setObject('portal_workflow', DummyWorkflowTool())
- # Hack, we need a _p_mtime for the file, so we make sure that it
- # has one. We use a subtransaction, which means we can rollback
- # later and pretend we didn't touch the ZODB.
- transaction.savepoint(optimistic=True)
- except:
- self.connection.close()
- raise
- else:
- return site
-
def _initPolicyAndUser( self
, a_lambda=None
, v_lambda=None
@@ -277,7 +259,7 @@
scp = _SensitiveSecurityPolicy( v_lambda, c_lambda )
SecurityManager.setSecurityPolicy( scp )
newSecurityManager( None
- , _AllowedUser( a_lambda ).__of__( self.root ) )
+ , _AllowedUser(a_lambda).__of__(self.app.acl_users))
def test_object_indexed_after_adding(self):
Modified: CMF/trunk/CMFCore/tests/test_ContentTypeRegistry.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_ContentTypeRegistry.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_ContentTypeRegistry.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,13 +15,11 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
-class MajorMinorPredicateTests( TestCase ):
+class MajorMinorPredicateTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFCore.ContentTypeRegistry import MajorMinorPredicate
@@ -77,7 +75,7 @@
assert not pred( 'foo', 'image/png', 'asdfljksadf' )
-class ExtensionPredicateTests( TestCase ):
+class ExtensionPredicateTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFCore.ContentTypeRegistry import ExtensionPredicate
@@ -127,7 +125,7 @@
assert not pred( 'foo.bar', 'text/html', 'asdfljksadf' )
-class MimeTypeRegexPredicateTests( TestCase ):
+class MimeTypeRegexPredicateTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFCore.ContentTypeRegistry \
@@ -174,7 +172,7 @@
assert not pred( 'foo', 'image/png', 'asdfljksadf' )
-class NameRegexPredicateTests( TestCase ):
+class NameRegexPredicateTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFCore.ContentTypeRegistry import NameRegexPredicate
@@ -219,7 +217,7 @@
assert not pred( 'bar', 'text/plain', 'asdfljksadf' )
-class ContentTypeRegistryTests( TestCase ):
+class ContentTypeRegistryTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFCore.ContentTypeRegistry import ContentTypeRegistry
@@ -278,13 +276,13 @@
def test_suite():
- return TestSuite((
- makeSuite( MajorMinorPredicateTests ),
- makeSuite( ExtensionPredicateTests ),
- makeSuite( MimeTypeRegexPredicateTests ),
- makeSuite( NameRegexPredicateTests ),
- makeSuite( ContentTypeRegistryTests ),
+ return unittest.TestSuite((
+ unittest.makeSuite(MajorMinorPredicateTests),
+ unittest.makeSuite(ExtensionPredicateTests),
+ unittest.makeSuite(MimeTypeRegexPredicateTests),
+ unittest.makeSuite(NameRegexPredicateTests),
+ unittest.makeSuite(ContentTypeRegistryTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_DirectoryView.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_DirectoryView.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_DirectoryView.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -1,7 +1,5 @@
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from os import remove, mkdir, rmdir
from os.path import join
@@ -13,6 +11,7 @@
from Products.CMFCore.tests.base.testcase import _prefix
from Products.CMFCore.tests.base.testcase import FSDVTest
from Products.CMFCore.tests.base.testcase import WarningInterceptor
+from Products.CMFCore.tests.base.testcase import WritableFSDVTest
from Products.CMFCore.DirectoryView import DirectoryView
@@ -25,7 +24,7 @@
pass
-class DirectoryViewPathTests( TestCase, WarningInterceptor ):
+class DirectoryViewPathTests(unittest.TestCase, WarningInterceptor):
"""
These test that, no matter what is stored in their dirpath,
FSDV's will do their best to find an appropriate skin
@@ -262,10 +261,10 @@
if DevelopmentMode:
- class DebugModeTests( FSDVTest ):
+ class DebugModeTests(WritableFSDVTest):
def setUp( self ):
- FSDVTest.setUp(self)
+ WritableFSDVTest.setUp(self)
self.test1path = join(self.skin_path_name,'test1.py')
self.test2path = join(self.skin_path_name,'test2.py')
self.test3path = join(self.skin_path_name,'test3')
@@ -327,18 +326,18 @@
else:
- class DebugModeTests( TestCase ):
+ class DebugModeTests(unittest.TestCase):
pass
def test_suite():
- return TestSuite((
- makeSuite(DirectoryViewPathTests),
- makeSuite(DirectoryViewTests),
- makeSuite(DirectoryViewIgnoreTests),
- makeSuite(DirectoryViewFolderTests),
- makeSuite(DebugModeTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(DirectoryViewPathTests),
+ unittest.makeSuite(DirectoryViewTests),
+ unittest.makeSuite(DirectoryViewIgnoreTests),
+ unittest.makeSuite(DirectoryViewFolderTests),
+ unittest.makeSuite(DebugModeTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_DiscussionTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_DiscussionTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_DiscussionTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,13 +15,11 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
-class DiscussionToolTests(TestCase):
+class DiscussionToolTests(unittest.TestCase):
def test_z2interfaces(self):
from Interface.Verify import verifyClass
@@ -44,7 +42,7 @@
verifyClass(IOldstyleDiscussionTool, DiscussionTool)
-class OldDiscussableTests(TestCase):
+class OldDiscussableTests(unittest.TestCase):
def test_z2interfaces(self):
from Interface.Verify import verifyClass
@@ -63,10 +61,10 @@
def test_suite():
- return TestSuite((
- makeSuite( DiscussionToolTests ),
- makeSuite( OldDiscussableTests ),
+ return unittest.TestSuite((
+ unittest.makeSuite(DiscussionToolTests),
+ unittest.makeSuite(OldDiscussableTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_DynamicType.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_DynamicType.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_DynamicType.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,10 +15,8 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from Acquisition import Implicit
from ZPublisher.BaseRequest import BaseRequest
@@ -41,7 +39,7 @@
portal_type = 'Dummy Content 15'
-class DynamicTypeTests(TestCase):
+class DynamicTypeTests(unittest.TestCase):
def setUp(self):
self.site = DummySite('site')
@@ -113,10 +111,10 @@
def test_suite():
- return TestSuite((
- makeSuite(DynamicTypeTests),
- makeSuite(DynamicTypeSecurityTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(DynamicTypeTests),
+ unittest.makeSuite(DynamicTypeSecurityTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_Expression.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_Expression.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_Expression.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -14,10 +14,9 @@
$Id$
"""
-from unittest import TestSuite, makeSuite, main
+
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from Products.CMFCore.ActionInformation import ActionInformation
from Products.CMFCore.Expression import createExprContext
@@ -89,9 +88,9 @@
def test_suite():
- return TestSuite((
- makeSuite(ExpressionTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(ExpressionTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_FSDTMLMethod.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSDTMLMethod.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_FSDTMLMethod.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -20,6 +20,7 @@
from os.path import join as path_join
+from DateTime import DateTime
from OFS.Folder import Folder
from Products.StandardCacheManagers import RAMCacheManager
@@ -32,7 +33,6 @@
from Products.CMFCore.tests.base.testcase import SecurityTest
from Products.CMFCore.tests.base.dummy import DummyContent
-from DateTime import DateTime
class FSDTMLMaker(FSDVTest):
@@ -43,7 +43,7 @@
return FSDTMLMethod( id, path, properties=metadata.getProperties() )
-class FSDTMLMethodTests( RequestTest, FSDTMLMaker ):
+class FSDTMLMethodTests(RequestTest, FSDTMLMaker):
def setUp(self):
FSDTMLMaker.setUp(self)
@@ -55,8 +55,8 @@
def test_Call( self ):
script = self._makeOne( 'testDTML', 'testDTML.dtml' )
- script = script.__of__(self.root)
- self.assertEqual(script(self.root, self.REQUEST), 'foo\n')
+ script = script.__of__(self.app)
+ self.assertEqual(script(self.app, self.REQUEST), 'nohost\n')
def test_caching( self ):
# Test HTTP caching headers.
Modified: CMF/trunk/CMFCore/tests/test_FSFile.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSFile.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_FSFile.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -14,10 +14,9 @@
$Id$
"""
+
import unittest
import Testing
-import Zope2
-Zope2.startup()
from os.path import join as path_join
@@ -27,7 +26,7 @@
from Products.CMFCore.tests.base.testcase import RequestTest
-class FSFileTests( RequestTest, FSDVTest):
+class FSFileTests(RequestTest, FSDVTest):
def setUp(self):
FSDVTest.setUp(self)
Modified: CMF/trunk/CMFCore/tests/test_FSImage.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSImage.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_FSImage.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -14,10 +14,9 @@
$Id$
"""
+
import unittest
import Testing
-import Zope2
-Zope2.startup()
from os.path import join as path_join
@@ -27,7 +26,7 @@
from Products.CMFCore.tests.base.testcase import RequestTest
-class FSImageTests( RequestTest, FSDVTest):
+class FSImageTests(RequestTest, FSDVTest):
def setUp(self):
FSDVTest.setUp(self)
Modified: CMF/trunk/CMFCore/tests/test_FSMetadata.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSMetadata.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_FSMetadata.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -14,10 +14,9 @@
$Id$
"""
-from unittest import TestSuite, makeSuite, main
+
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from test_FSSecurity import FSSecurityBase
@@ -85,9 +84,9 @@
def test_suite():
- return TestSuite((
- makeSuite(FSMetadata),
+ return unittest.TestSuite((
+ unittest.makeSuite(FSMetadata),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_FSPageTemplate.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSPageTemplate.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_FSPageTemplate.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -14,11 +14,11 @@
$Id$
"""
-from unittest import TestSuite, makeSuite, main
-import Testing
-import Zope2
-Zope2.startup()
+import unittest
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('PageTemplates', 1)
+
from os.path import join as path_join
from OFS.Folder import Folder
@@ -57,10 +57,9 @@
cleanUp()
def test_Call( self ):
-
script = self._makeOne( 'testPT', 'testPT.pt' )
- script = script.__of__(self.root)
- self.assertEqual(script(),'foo\n')
+ script = script.__of__(self.app)
+ self.assertEqual(script(), 'nohost\n')
def test_ContentType(self):
script = self._makeOne( 'testXMLPT', 'testXMLPT.pt' )
@@ -187,10 +186,10 @@
def test_suite():
- return TestSuite((
- makeSuite(FSPageTemplateTests),
- makeSuite(FSPageTemplateCustomizationTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(FSPageTemplateTests),
+ unittest.makeSuite(FSPageTemplateCustomizationTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_FSPropertiesObject.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSPropertiesObject.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_FSPropertiesObject.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -1,7 +1,5 @@
-from unittest import TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from os.path import join
@@ -52,9 +50,9 @@
def test_suite():
- return TestSuite((
- makeSuite(FSPropertiesObjectCustomizationTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(FSPropertiesObjectCustomizationTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_FSPythonScript.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSPythonScript.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_FSPythonScript.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -14,12 +14,11 @@
$Id$
"""
+
import unittest
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('PythonScripts', 1)
-import Testing
-import Zope2
-Zope2.startup()
-
from os.path import join
from sys import exc_info
from thread import start_new_thread
@@ -29,8 +28,8 @@
from OFS.SimpleItem import SimpleItem
from Products.StandardCacheManagers import RAMCacheManager
-from Products.CMFCore.FSPythonScript import FSPythonScript
from Products.CMFCore.FSMetadata import FSMetadata
+from Products.CMFCore.FSPythonScript import FSPythonScript
from Products.CMFCore.tests.base.testcase import FSDVTest
from Products.CMFCore.tests.base.testcase import SecurityTest
from Products.CMFCore.tests.base.testcase import WarningInterceptor
Modified: CMF/trunk/CMFCore/tests/test_FSSecurity.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSSecurity.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_FSSecurity.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -14,22 +14,21 @@
$Id$
"""
-from unittest import TestSuite, makeSuite, main
+
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from time import sleep
from AccessControl.Permission import Permission
from Globals import DevelopmentMode
-from Products.CMFCore.tests.base.testcase import FSDVTest
-from Products.CMFCore.tests.base.testcase import RequestTest
from Products.CMFCore.tests.base.testcase import LogInterceptor
+from Products.CMFCore.tests.base.testcase import RequestTest
+from Products.CMFCore.tests.base.testcase import WritableFSDVTest
-class FSSecurityBase( RequestTest, FSDVTest, LogInterceptor ):
+class FSSecurityBase(RequestTest, WritableFSDVTest, LogInterceptor):
def _checkSettings(self, object, permissionname, acquire=0, roles=[]):
# check the roles and acquire settings for a permission on an
@@ -55,7 +54,7 @@
def setUp( self ):
# initialise skins
- FSDVTest.setUp(self)
+ WritableFSDVTest.setUp(self)
self._registerDirectory(self)
# set up ZODB
RequestTest.setUp(self)
@@ -67,7 +66,7 @@
def tearDown( self ):
RequestTest.tearDown(self)
- FSDVTest.tearDown(self)
+ WritableFSDVTest.tearDown(self)
self._ignore_log_errors()
@@ -170,10 +169,10 @@
def test_suite():
- return TestSuite((
- makeSuite(FSSecurityTests),
- makeSuite(DebugModeTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(FSSecurityTests),
+ unittest.makeSuite(DebugModeTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_FSZSQLMethod.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSZSQLMethod.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_FSZSQLMethod.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -1,17 +1,17 @@
-from unittest import TestSuite, makeSuite, main
+import unittest
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('ZSQLMethods', 1)
+
from os.path import join
-import Testing
-import Zope2
-Zope2.startup()
-
from OFS.Folder import Folder
+from Products.CMFCore.FSMetadata import FSMetadata
from Products.CMFCore.FSZSQLMethod import FSZSQLMethod
-from Products.CMFCore.FSMetadata import FSMetadata
from Products.CMFCore.tests.base.testcase import FSDVTest
from Products.CMFCore.tests.base.testcase import SecurityTest
+
class FSZSQLMaker(FSDVTest):
def _makeOne( self, id, filename ):
@@ -20,8 +20,9 @@
metadata.read()
return FSZSQLMethod( id, path, properties=metadata.getProperties() )
-class FSZSQLMethodTests( FSDVTest ):
+class FSZSQLMethodTests(FSDVTest):
+
def setUp(self):
FSDVTest.setUp(self)
self._registerDirectory(self)
@@ -89,10 +90,10 @@
def test_suite():
- return TestSuite((
- makeSuite(FSZSQLMethodTests),
- makeSuite(FSZSQLMethodCustomizationTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(FSZSQLMethodTests),
+ unittest.makeSuite(FSZSQLMethodCustomizationTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_MemberDataTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_MemberDataTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_MemberDataTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,13 +15,12 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
import Acquisition
+
class DummyUserFolder(Acquisition.Implicit):
def __init__(self):
@@ -64,7 +63,7 @@
pass
-class MemberDataToolTests(TestCase):
+class MemberDataToolTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFCore.MemberDataTool import MemberDataTool
@@ -131,7 +130,7 @@
self.assertEqual(info_dict['orphan_count'], 0)
-class MemberDataTests(TestCase):
+class MemberDataTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFCore.MemberDataTool import MemberData
@@ -175,10 +174,10 @@
def test_suite():
- return TestSuite((
- makeSuite( MemberDataToolTests ),
- makeSuite( MemberDataTests ),
+ return unittest.TestSuite((
+ unittest.makeSuite(MemberDataToolTests),
+ unittest.makeSuite(MemberDataTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_MembershipTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_MembershipTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_MembershipTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,10 +15,8 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from AccessControl.SecurityManagement import newSecurityManager
from OFS.Folder import Folder
@@ -31,7 +29,7 @@
from Products.CMFCore.tests.base.testcase import SecurityTest
-class MembershipToolTests(TestCase):
+class MembershipToolTests(unittest.TestCase):
def test_z2interfaces(self):
from Interface.Verify import verifyClass
@@ -185,11 +183,12 @@
nonlocal_member = tool.getMemberById(NONLOCAL_USER_ID)
self.assertEqual(nonlocal_member.getId(), NONLOCAL_USER_ID)
+
def test_suite():
- return TestSuite((
- makeSuite( MembershipToolTests ),
- makeSuite( MembershipToolSecurityTests )
+ return unittest.TestSuite((
+ unittest.makeSuite(MembershipToolTests),
+ unittest.makeSuite(MembershipToolSecurityTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_PortalFolder.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_PortalFolder.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_PortalFolder.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -18,21 +18,15 @@
import unittest
import Testing
-import cStringIO
-
import transaction
from AccessControl.SecurityManagement import newSecurityManager
-from AccessControl.SecurityManagement import noSecurityManager
from AccessControl import SecurityManager
from AccessControl import Unauthorized
from Acquisition import aq_base
from Acquisition import Implicit
from DateTime import DateTime
-from OFS.Application import Application
from OFS.Image import manage_addFile
-from OFS.tests.testCopySupport import makeConnection
from Products.Five import zcml
-from Testing.makerequest import makerequest
from zope.component import getGlobalSiteManager
from zope.component.interfaces import IFactory
from zope.testing.cleanup import cleanUp
@@ -44,6 +38,7 @@
from Products.CMFCore.tests.base.dummy import DummyFactoryDispatcher
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyUserFolder
+from Products.CMFCore.tests.base.testcase import SecurityRequestTest
from Products.CMFCore.tests.base.testcase import SecurityTest
from Products.CMFCore.tests.base.testcase import setUpEvents
from Products.CMFCore.tests.base.tidata import FTIDATA_CMF15
@@ -865,68 +860,36 @@
def allowed( self, object, object_roles=None ):
return self._lambdas[ 0 ]( object, object_roles )
-class PortalFolderCopySupportTests(unittest.TestCase):
- _old_policy = None
+class PortalFolderCopySupportTests(SecurityRequestTest):
- def setUp( self ):
+ def setUp(self):
import Products
- self._scrubSecurity()
+ SecurityRequestTest.setUp(self)
zcml.load_config('meta.zcml', Products.Five)
zcml.load_config('permissions.zcml', Products.Five)
zcml.load_config('content.zcml', Products.CMFCore)
- def tearDown( self ):
- self._scrubSecurity()
- self._cleanApp()
+ def tearDown(self):
+ SecurityRequestTest.tearDown(self)
cleanUp()
- def _initFolders( self ):
+ def _initFolders(self):
from Products.CMFCore.PortalFolder import PortalFolder
- self.connection = makeConnection()
- try:
- r = self.connection.root()
- a = Application()
- r['Application'] = a
- self.root = a
- responseOut = self.responseOut = cStringIO.StringIO()
- self.app = makerequest( self.root, stdout=responseOut )
- self.app._setObject( 'folder1', PortalFolder( 'folder1' ) )
- self.app._setObject( 'folder2', PortalFolder( 'folder2' ) )
- folder1 = getattr( self.app, 'folder1' )
- folder2 = getattr( self.app, 'folder2' )
+ self.app._setObject( 'folder1', PortalFolder( 'folder1' ) )
+ self.app._setObject( 'folder2', PortalFolder( 'folder2' ) )
+ folder1 = getattr( self.app, 'folder1' )
+ folder2 = getattr( self.app, 'folder2' )
+ manage_addFile(folder1, 'file', file='', content_type='text/plain')
- manage_addFile( folder1, 'file'
- , file='', content_type='text/plain')
-
- # Hack, we need a _p_mtime for the file, so we make sure that it
- # has one. We use a subtransaction, which means we can rollback
- # later and pretend we didn't touch the ZODB.
- transaction.savepoint(optimistic=True)
- except:
- self.connection.close()
- raise
-
+ # Hack, we need a _p_mtime for the file, so we make sure that it
+ # has one. We use a subtransaction, which means we can rollback
+ # later and pretend we didn't touch the ZODB.
+ transaction.savepoint(optimistic=True)
return self.app._getOb( 'folder1' ), self.app._getOb( 'folder2' )
- def _cleanApp( self ):
-
- transaction.abort()
- self.connection.close()
- del self.app
- del self.responseOut
- del self.root
- del self.connection
-
- def _scrubSecurity( self ):
-
- noSecurityManager()
-
- if self._old_policy is not None:
- SecurityManager.setSecurityPolicy( self._old_policy )
-
def _assertCopyErrorUnauth( self, callable, *args, **kw ):
import re
@@ -975,10 +938,10 @@
c_lambda = _promiscuous
scp = _SensitiveSecurityPolicy( v_lambda, c_lambda )
- self._old_policy = SecurityManager.setSecurityPolicy( scp )
+ SecurityManager.setSecurityPolicy( scp )
newSecurityManager( None
- , _AllowedUser( a_lambda ).__of__( self.root ) )
+ , _AllowedUser(a_lambda).__of__(self.app.acl_users))
def test_copy_baseline( self ):
Modified: CMF/trunk/CMFCore/tests/test_RegistrationTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_RegistrationTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_RegistrationTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,13 +15,11 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
-class RegistrationToolTests(TestCase):
+class RegistrationToolTests(unittest.TestCase):
def _makeOne(self):
from Products.CMFCore.RegistrationTool import RegistrationTool
@@ -54,9 +52,9 @@
def test_suite():
- return TestSuite((
- makeSuite( RegistrationToolTests ),
+ return unittest.TestSuite((
+ unittest.makeSuite(RegistrationToolTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_SkinsTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_SkinsTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_SkinsTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,13 +15,11 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
-class SkinsContainerTests(TestCase):
+class SkinsContainerTests(unittest.TestCase):
def test_z2interfaces(self):
from Interface.Verify import verifyClass
@@ -39,7 +37,7 @@
verifyClass(ISkinsContainer, SkinsContainer)
-class SkinsToolTests(TestCase):
+class SkinsToolTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFCore.SkinsTool import SkinsTool
@@ -91,7 +89,7 @@
self.failUnless(paths.find('.svn') == -1)
-class SkinnableTests(TestCase):
+class SkinnableTests(unittest.TestCase):
def _makeOne(self):
from Products.CMFCore.SkinsTool import SkinsTool
@@ -128,11 +126,11 @@
def test_suite():
- return TestSuite((
- makeSuite(SkinsContainerTests),
- makeSuite(SkinsToolTests),
- makeSuite(SkinnableTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(SkinsContainerTests),
+ unittest.makeSuite(SkinsToolTests),
+ unittest.makeSuite(SkinnableTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_URLTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_URLTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_URLTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,17 +15,15 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from Products.CMFCore.tests.base.dummy import DummyContent
from Products.CMFCore.tests.base.dummy import DummyFolder
from Products.CMFCore.tests.base.dummy import DummySite
-class URLToolTests(TestCase):
+class URLToolTests(unittest.TestCase):
def setUp(self):
self.site = DummySite(id='foo')
@@ -79,9 +77,9 @@
def test_suite():
- return TestSuite((
- makeSuite( URLToolTests ),
+ return unittest.TestSuite((
+ unittest.makeSuite( URLToolTests ),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_UndoTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_UndoTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_UndoTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,13 +15,11 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
-class UndoToolTests(TestCase):
+class UndoToolTests(unittest.TestCase):
def test_z2interfaces(self):
from Interface.Verify import verifyClass
@@ -45,9 +43,9 @@
def test_suite():
- return TestSuite((
- makeSuite( UndoToolTests ),
+ return unittest.TestSuite((
+ unittest.makeSuite(UndoToolTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_fiveactionstool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_fiveactionstool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFCore/tests/test_fiveactionstool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,9 +15,8 @@
$Id$
"""
-import os, sys
-if __name__ == '__main__':
- execfile(os.path.join(sys.path[0], 'framework.py'))
+import unittest
+from Testing import ZopeTestCase
def test_fiveactionstool():
@@ -106,8 +105,9 @@
def test_suite():
- from Testing.ZopeTestCase import ZopeDocTestSuite
- return ZopeDocTestSuite()
+ return unittest.TestSuite((
+ ZopeTestCase.ZopeDocTestSuite(),
+ ))
if __name__ == '__main__':
- framework()
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFDefault/tests/test_DiscussionReply.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_DiscussionReply.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFDefault/tests/test_DiscussionReply.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -16,7 +16,11 @@
"""
import unittest
-import Testing
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('ZCTextIndex', 1)
+ZopeTestCase.installProduct('Five', 1)
+ZopeTestCase.installProduct('CMFCore', 1)
+ZopeTestCase.installProduct('CMFDefault', 1)
import Products
from AccessControl.SecurityManagement import newSecurityManager
@@ -25,16 +29,19 @@
from zope.testing.cleanup import cleanUp
from Products.CMFCore.tests.base.testcase import RequestTest
+from Products.CMFCore.tests.base.testcase import setUpGenericSetup
from Products.CMFCore.tests.base.testcase import setUpTraversing
class DiscussionReplyTest(RequestTest):
def setUp(self):
+ import Products.DCWorkflow
+
RequestTest.setUp(self)
setUpTraversing()
+ setUpGenericSetup()
zcml.load_config('permissions.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.GenericSetup)
zcml.load_config('configure.zcml', Products.CMFCore)
zcml.load_config('configure.zcml', Products.CMFDefault)
zcml.load_config('configure.zcml', Products.DCWorkflow)
Modified: CMF/trunk/CMFDefault/tests/test_DiscussionTool.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_DiscussionTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFDefault/tests/test_DiscussionTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,17 +15,15 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from Products.CMFCore.tests.base.dummy import DummyFolder
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
-class DiscussionToolTests(TestCase):
+class DiscussionToolTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFDefault.DiscussionTool import DiscussionTool
@@ -101,9 +99,9 @@
def test_suite():
- return TestSuite((
- makeSuite( DiscussionToolTests ),
+ return unittest.TestSuite((
+ unittest.makeSuite(DiscussionToolTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFDefault/tests/test_DublinCore.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_DublinCore.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFDefault/tests/test_DublinCore.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,10 +15,8 @@
$Id$
"""
-from unittest import TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from AccessControl.SecurityManagement import newSecurityManager
from Acquisition import Implicit
@@ -202,9 +200,9 @@
def test_suite():
- return TestSuite((
- makeSuite( DublinCoreTests ),
+ return unittest.TestSuite((
+ unittest.makeSuite(DublinCoreTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFDefault/tests/test_Image.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_Image.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFDefault/tests/test_Image.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -16,7 +16,11 @@
"""
import unittest
-import Testing
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('ZCTextIndex', 1)
+ZopeTestCase.installProduct('Five', 1)
+ZopeTestCase.installProduct('CMFCore', 1)
+ZopeTestCase.installProduct('CMFDefault', 1)
from os.path import join as path_join
from cStringIO import StringIO
@@ -34,6 +38,7 @@
from Products.CMFCore.tests.base.security import OmnipotentUser
from Products.CMFCore.tests.base.testcase import SecurityRequestTest
from Products.CMFCore.tests.base.testcase import setUpEvents
+from Products.CMFCore.tests.base.testcase import setUpGenericSetup
from Products.CMFCore.tests.base.testcase import setUpTraversing
from Products.CMFDefault import tests
@@ -108,11 +113,13 @@
# Copy/pasting an image (or file) should reset the object's workflow state.
def setUp(self):
+ import Products.DCWorkflow
+
SecurityRequestTest.setUp(self)
setUpEvents()
setUpTraversing()
+ setUpGenericSetup()
zcml.load_config('permissions.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.GenericSetup)
zcml.load_config('configure.zcml', Products.CMFCore)
zcml.load_config('configure.zcml', Products.CMFDefault)
zcml.load_config('configure.zcml', Products.DCWorkflow)
Modified: CMF/trunk/CMFDefault/tests/test_MembershipTool.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_MembershipTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFDefault/tests/test_MembershipTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,10 +15,8 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from AccessControl.SecurityManagement import newSecurityManager
@@ -30,7 +28,7 @@
from Products.CMFCore.tests.base.testcase import SecurityTest
-class MembershipToolTests(TestCase):
+class MembershipToolTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFDefault.MembershipTool import MembershipTool
@@ -133,10 +131,10 @@
def test_suite():
- return TestSuite((
- makeSuite( MembershipToolTests ),
- makeSuite( MembershipToolSecurityTests )
+ return unittest.TestSuite((
+ unittest.makeSuite(MembershipToolTests),
+ unittest.makeSuite(MembershipToolSecurityTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFDefault/tests/test_MetadataTool.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_MetadataTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFDefault/tests/test_MetadataTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -14,15 +14,14 @@
$Id$
"""
+
import unittest
import Testing
-import Zope2
-Zope2.startup()
from Acquisition import aq_base
-class TestMetadataElementPolicy( unittest.TestCase ):
+class TestMetadataElementPolicy(unittest.TestCase):
def _getTargetClass( self ):
from Products.CMFDefault.MetadataTool import MetadataElementPolicy
@@ -72,7 +71,7 @@
self.failUnless( 'yyy' in mv_policy.allowedVocabulary() )
-class TestElementSpec( unittest.TestCase ):
+class TestElementSpec(unittest.TestCase):
def _getTargetClass( self ):
from Products.CMFDefault.MetadataTool import ElementSpec
@@ -99,7 +98,7 @@
-class TestMetadataSchema( unittest.TestCase ):
+class TestMetadataSchema(unittest.TestCase):
def _getTargetClass( self ):
from Products.CMFDefault.MetadataTool import MetadataSchema
@@ -109,7 +108,7 @@
return self._getTargetClass()( *args, **kw )
-class TestMetadataTool( unittest.TestCase ):
+class TestMetadataTool(unittest.TestCase):
def _getTargetClass( self ):
from Products.CMFDefault.MetadataTool import MetadataTool
Modified: CMF/trunk/CMFDefault/tests/test_Portal.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_Portal.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFDefault/tests/test_Portal.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -16,7 +16,11 @@
"""
import unittest
-import Testing
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('ZCTextIndex', 1)
+ZopeTestCase.installProduct('Five', 1)
+ZopeTestCase.installProduct('CMFCore', 1)
+ZopeTestCase.installProduct('CMFDefault', 1)
import Products
from Acquisition import aq_base
@@ -25,6 +29,7 @@
from Products.CMFCore.tests.base.testcase import SecurityRequestTest
from Products.CMFCore.tests.base.testcase import setUpEvents
+from Products.CMFCore.tests.base.testcase import setUpGenericSetup
from Products.CMFCore.tests.base.testcase import setUpTraversing
@@ -48,11 +53,13 @@
return content
def setUp(self):
+ import Products.DCWorkflow
+
SecurityRequestTest.setUp(self)
setUpEvents()
setUpTraversing()
+ setUpGenericSetup()
zcml.load_config('permissions.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.GenericSetup)
zcml.load_config('configure.zcml', Products.CMFCore)
zcml.load_config('configure.zcml', Products.CMFDefault)
zcml.load_config('configure.zcml', Products.DCWorkflow)
Modified: CMF/trunk/CMFDefault/tests/test_PropertiesTool.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_PropertiesTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFDefault/tests/test_PropertiesTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,13 +15,11 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
-class PropertiesToolTests(TestCase):
+class PropertiesToolTests(unittest.TestCase):
def test_z2interfaces(self):
from Interface.Verify import verifyClass
@@ -45,9 +43,9 @@
def test_suite():
- return TestSuite((
- makeSuite( PropertiesToolTests ),
+ return unittest.TestSuite((
+ unittest.makeSuite(PropertiesToolTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFDefault/tests/test_RegistrationTool.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_RegistrationTool.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFDefault/tests/test_RegistrationTool.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -17,8 +17,6 @@
import unittest
import Testing
-import Zope2
-Zope2.startup()
from Products.CMFCore.tests.base.testcase import RequestTest
@@ -138,7 +136,7 @@
def test_suite():
return unittest.TestSuite((
- unittest.makeSuite( RegistrationToolTests ),
+ unittest.makeSuite(RegistrationToolTests),
))
if __name__ == '__main__':
Modified: CMF/trunk/CMFDefault/tests/test_join.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_join.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFDefault/tests/test_join.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -16,23 +16,30 @@
"""
import unittest
-import Testing
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('ZCTextIndex', 1)
+ZopeTestCase.installProduct('Five', 1)
+ZopeTestCase.installProduct('CMFCore', 1)
+ZopeTestCase.installProduct('CMFDefault', 1)
import Products
from Products.Five import zcml
from zope.testing.cleanup import cleanUp
+from Products.CMFCore.tests.base.testcase import setUpGenericSetup
from Products.CMFCore.tests.base.testcase import TransactionalTest
class MembershipTests(TransactionalTest):
def setUp(self):
+ import Products.DCWorkflow
+
TransactionalTest.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ setUpGenericSetup()
zcml.load_config('permissions.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.GenericSetup)
zcml.load_config('configure.zcml', Products.CMFCore)
+ zcml.load_config('configure.zcml', Products.CMFDefault)
zcml.load_config('configure.zcml', Products.DCWorkflow)
def tearDown(self):
Modified: CMF/trunk/CMFDefault/tests/test_utils.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_utils.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFDefault/tests/test_utils.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -14,10 +14,9 @@
$Id$
"""
-from unittest import TestCase, makeSuite, main
+
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from Products.CMFCore.tests.base.content import FAUX_HTML_LEADING_TEXT
from Products.CMFCore.tests.base.content import SIMPLE_HTML
@@ -26,7 +25,8 @@
from Products.CMFCore.tests.base.content import STX_WITH_HTML
-class DefaultUtilsTests(TestCase):
+class DefaultUtilsTests(unittest.TestCase):
+
COMMON_HEADERS = '''Author: Tres Seaver
Title: Test Products.CMFDefault.utils.parseHeadersBody'''
@@ -261,8 +261,11 @@
self.assertEqual( formatted
, 'Foo: foo\r\nBar: bar\r\n \r\n with multiline' )
+
def test_suite():
- return makeSuite(DefaultUtilsTests)
+ return unittest.TestSuite((
+ unittest.makeSuite(DefaultUtilsTests),
+ ))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFTopic/tests/test_DateC.py
===================================================================
--- CMF/trunk/CMFTopic/tests/test_DateC.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFTopic/tests/test_DateC.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -16,13 +16,19 @@
"""
import unittest
-import Testing
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('ZCTextIndex', 1)
+ZopeTestCase.installProduct('Five', 1)
+ZopeTestCase.installProduct('CMFCore', 1)
+ZopeTestCase.installProduct('CMFDefault', 1)
import Products
from DateTime.DateTime import DateTime
+from Products.Five import zcml
from zope.testing.cleanup import cleanUp
from Products.CMFCore.tests.base.testcase import RequestTest
+from Products.CMFCore.tests.base.testcase import setUpGenericSetup
from Products.CMFCore.tests.base.dummy import DummyContent
from Products.CMFTopic.Topic import Topic
@@ -158,15 +164,13 @@
day_diffs.extend(selectable_diffs)
def setUp(self):
- import Products.CMFCore
- import Products.Five
- from Products.Five import zcml
- import Products.GenericSetup
+ import Products.DCWorkflow
+
RequestTest.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ setUpGenericSetup()
zcml.load_config('permissions.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.GenericSetup)
zcml.load_config('configure.zcml', Products.CMFCore)
+ zcml.load_config('configure.zcml', Products.CMFDefault)
zcml.load_config('configure.zcml', Products.DCWorkflow)
factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
Modified: CMF/trunk/CMFTopic/tests/test_ListC.py
===================================================================
--- CMF/trunk/CMFTopic/tests/test_ListC.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFTopic/tests/test_ListC.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,10 +15,8 @@
$Id$
"""
-from unittest import TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from common import CriterionTestCase
@@ -83,9 +81,9 @@
def test_suite():
- return TestSuite((
- makeSuite(ListCriterionTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(ListCriterionTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFTopic/tests/test_SIC.py
===================================================================
--- CMF/trunk/CMFTopic/tests/test_SIC.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFTopic/tests/test_SIC.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,10 +15,8 @@
$Id$
"""
-from unittest import TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from common import CriterionTestCase
@@ -147,9 +145,9 @@
def test_suite():
- return TestSuite((
- makeSuite(SimpleIntCriterionTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(SimpleIntCriterionTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFTopic/tests/test_SSC.py
===================================================================
--- CMF/trunk/CMFTopic/tests/test_SSC.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFTopic/tests/test_SSC.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,10 +15,8 @@
$Id$
"""
-from unittest import TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from common import CriterionTestCase
@@ -56,9 +54,9 @@
def test_suite():
- return TestSuite((
- makeSuite(SimpleStringCriterionTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(SimpleStringCriterionTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFTopic/tests/test_SortC.py
===================================================================
--- CMF/trunk/CMFTopic/tests/test_SortC.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFTopic/tests/test_SortC.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -15,10 +15,8 @@
$Id$
"""
-from unittest import TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
from common import CriterionTestCase
@@ -64,9 +62,9 @@
def test_suite():
- return TestSuite((
- makeSuite(SortCriterionTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(SortCriterionTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFTopic/tests/test_Topic.py
===================================================================
--- CMF/trunk/CMFTopic/tests/test_Topic.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/CMFTopic/tests/test_Topic.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -16,7 +16,8 @@
"""
import unittest
-import Testing
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('CMFTopic', 1)
from Acquisition import Implicit
from zope.testing.cleanup import cleanUp
Modified: CMF/trunk/DCWorkflow/tests/test_exportimport.py
===================================================================
--- CMF/trunk/DCWorkflow/tests/test_exportimport.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/DCWorkflow/tests/test_exportimport.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -23,7 +23,6 @@
from Products.ExternalMethod.ExternalMethod import ExternalMethod
from Products.Five import zcml
-import Products.GenericSetup.PythonScripts
from Products.CMFCore.exportimport.tests.test_workflow \
import _BINDINGS_TOOL_EXPORT
from Products.CMFCore.exportimport.tests.test_workflow import _DUMMY_ZCML
@@ -34,6 +33,7 @@
from Products.CMFCore.exportimport.tests.test_workflow import DummyWorkflow
from Products.CMFCore.exportimport.tests.test_workflow \
import DummyWorkflowTool
+from Products.CMFCore.tests.base.testcase import setUpGenericSetup
from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION
from Products.DCWorkflow.Transitions import TRIGGER_AUTOMATIC
@@ -78,9 +78,9 @@
def setUp(self):
WorkflowSetupBase.setUp(self)
+ setUpGenericSetup()
zcml.load_config('permissions.zcml', Products.Five)
zcml.load_config('configure.zcml', Products.DCWorkflow)
- zcml.load_config('configure.zcml', Products.GenericSetup.PythonScripts)
def _initDCWorkflow( self, workflow_id ):
Modified: CMF/trunk/DCWorkflow/tests/test_roles.py
===================================================================
--- CMF/trunk/DCWorkflow/tests/test_roles.py 2006-06-05 13:31:36 UTC (rev 68495)
+++ CMF/trunk/DCWorkflow/tests/test_roles.py 2006-06-05 16:30:18 UTC (rev 68496)
@@ -17,8 +17,6 @@
import unittest
import Testing
-import Zope2
-Zope2.startup()
from OFS.Folder import Folder
from OFS.Application import Application
@@ -66,7 +64,9 @@
def test_suite():
- return unittest.makeSuite(RoleMapTests)
+ return unittest.TestSuite((
+ unittest.makeSuite(RoleMapTests),
+ ))
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
More information about the CMF-checkins
mailing list