[CMF-checkins] CVS: Products/CMFCore/tests/base - testcase.py:1.13

Yvo Schubbe y.2005- at wcm-solutions.de
Tue Apr 5 05:27:24 EDT 2005


Update of /cvs-repository/Products/CMFCore/tests/base
In directory cvs.zope.org:/tmp/cvs-serv4750/CMFCore/tests/base

Modified Files:
	testcase.py 
Log Message:
- replaced get_transaction() by the transaction API used in Zope 2.8
- added utils.transaction for Zope 2.7 compatibility
- replaced commit() by commit(1) in test_PortalFolder.py
- related import and whitespace cleanup


=== Products/CMFCore/tests/base/testcase.py 1.12 => 1.13 ===
--- Products/CMFCore/tests/base/testcase.py:1.12	Mon Apr  4 06:10:26 2005
+++ Products/CMFCore/tests/base/testcase.py	Tue Apr  5 05:26:54 2005
@@ -19,10 +19,9 @@
 from Testing.makerequest import makerequest
 try:
     import transaction
-    has_transaction = True
 except ImportError:
     # BBB: for Zope 2.7
-    has_transaction = False
+    from Products.CMFCore.utils import transaction
 
 from dummy import DummyFolder
 from security import AnonymousUser
@@ -32,20 +31,12 @@
 class TransactionalTest( TestCase ):
 
     def setUp( self ):
-        if has_transaction:
-            transaction.begin()
-        else:
-            # BBB: for Zope 2.7
-            get_transaction().begin()
+        transaction.begin()
         self.connection = Zope2.DB.open()
         self.root =  self.connection.root()[ 'Application' ]
 
     def tearDown( self ):
-        if has_transaction:
-            transaction.abort()
-        else:
-            # BBB: for Zope 2.7
-            get_transaction().abort()
+        transaction.abort()
         self.connection.close()
 
 
@@ -61,11 +52,7 @@
 class SecurityTest( TestCase ):
 
     def setUp(self):
-        if has_transaction:
-            transaction.begin()
-        else:
-            # BBB: for Zope 2.7
-            get_transaction().begin()
+        transaction.begin()
         self._policy = PermissiveSecurityPolicy()
         self._oldPolicy = setSecurityPolicy(self._policy)
         self.connection = Zope2.DB.open()
@@ -73,11 +60,7 @@
         newSecurityManager( None, AnonymousUser().__of__( self.root ) )
 
     def tearDown( self ):
-        if has_transaction:
-            transaction.abort()
-        else:
-            # BBB: for Zope 2.7
-            get_transaction().abort()
+        transaction.abort()
         self.connection.close()
         noSecurityManager()
         setSecurityPolicy(self._oldPolicy)



More information about the CMF-checkins mailing list