[Zope3-checkins] CVS: Zope3/src/transaction/tests - __init__.py:1.2 abstestIDataManager.py:1.2

Jim Fulton jim@zope.com
Wed, 25 Dec 2002 09:13:46 -0500


Update of /cvs-repository/Zope3/src/transaction/tests
In directory cvs.zope.org:/tmp/cvs-serv15352/src/transaction/tests

Added Files:
	__init__.py abstestIDataManager.py 
Log Message:
Grand renaming:

- Renamed most files (especially python modules) to lower case.

- Moved views and interfaces into separate hierarchies within each
  project, where each top-level directory under the zope package
  is a separate project.

- Moved everything to src from lib/python.

  lib/python will eventually go away. I need access to the cvs
  repository to make this happen, however.

There are probably some bits that are broken. All tests pass
and zope runs, but I haven't tried everything. There are a number
of cleanups I'll work on tomorrow.



=== Zope3/src/transaction/tests/__init__.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:13:46 2002
+++ Zope3/src/transaction/tests/__init__.py	Wed Dec 25 09:12:15 2002
@@ -0,0 +1,14 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+# Make this directory a package


=== Zope3/src/transaction/tests/abstestIDataManager.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:13:46 2002
+++ Zope3/src/transaction/tests/abstestIDataManager.py	Wed Dec 25 09:12:15 2002
@@ -0,0 +1,66 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""Test cases for objects implementing IDataManager.
+
+This is a combo test between Connection and DB, since the two are
+rather incestuous and the DB Interface is not defined that I was
+able to find.
+
+To do a full test suite one would probably want to write a dummy
+storage that will raise errors as needed for testing.
+
+I started this test suite to reproduce a very simple error (tpc_abort
+had an error and wouldn't even run if called).  So it is *very*
+incomplete, and even the tests that exist do not make sure that
+the data actually gets written/not written to the storge.
+
+Obviously this test suite should be expanded.
+
+$Id$
+"""
+
+import os
+from unittest import TestCase
+
+from transaction.txn import Transaction
+
+class IDataManagerTests(TestCase, object):
+
+    def setUp(self):
+        self.datamgr = None # subclass should override
+        self.obj = None # subclass should define Persistent object
+        self.txn_factory = None
+
+    def get_transaction(self):
+        return self.txn_factory()
+
+    ################################
+    # IDataManager interface tests #
+    ################################
+
+    def testCommitObj(self):
+        tran = self.get_transaction()
+        self.datamgr.prepare(tran)
+        self.datamgr.commit(tran)
+
+    def testAbortTran(self):
+        tran = self.get_transaction()
+        self.datamgr.prepare(tran)
+        self.datamgr.abort(tran)
+
+    def testRollback(self):
+        tran = self.get_transaction()
+        rb = self.datamgr.savepoint(tran)
+        if rb is not None:
+            rb.rollback()