Hi all,

I've ported the transaction package to Python 3 here:

http://svn.zope.org/transaction/branches/chrism-py3/

To get Python 3 support, it ditches 2.4 and 2.5 support, although I may
try to readd 2.5 support.

Anyway, it all seems to work given those limitations, but I'm having
trouble making the doctests pass on Python 3.  Are there any doctest
ninjas willing to have a look?

Here's how to see the failure output (I've also appended them below):

svn co svn+ssh://svn.zope.org/repos/main/transaction/branches/chrism-py3
cd chrism-py3
virtualenv3.2 --no-site-packages env32
env32/bin/python setup.py develop
env32/bin/python setup.py test

- C


Doctest output below:

"""
[chrism@thinko transaction]$ env32/bin/python setup.py test -q
running test
running egg_info
writing requirements to transaction.egg-info/requires.txt
writing transaction.egg-info/PKG-INFO
writing top-level names to transaction.egg-info/top_level.txt
writing dependency_links to transaction.egg-info/dependency_links.txt
writing entry points to transaction.egg-info/entry_points.txt
writing manifest file 'transaction.egg-info/SOURCES.txt'
running build_ext
....Failed to abort resource manager: <BasicJar 2FC0090 ('abort',)>
Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 506, in abort
    rm.abort(self)
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
318, in abort
    self.check('abort')
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
313, in check
    raise TestTxnException("error %s" % method)
transaction.tests.test_transaction.TestTxnException: error abort
..Error in tpc_abort() on manager <BasicJar 3097E50 ('tpc_abort',
'tpc_vote')>
Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 449, in _commitResources
    rm.tpc_vote(self)
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
330, in tpc_vote
    self.check('tpc_vote')
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
313, in check
    raise TestTxnException("error %s" % method)
transaction.tests.test_transaction.TestTxnException: error tpc_vote

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 487, in _cleanup
    rm.tpc_abort(self)
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
334, in tpc_abort
    self.check('tpc_abort')
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
313, in check
    raise TestTxnException("error %s" % method)
transaction.tests.test_transaction.TestTxnException: error tpc_abort
........F.Error in tpc_abort() on manager
<transaction.tests.test_transaction.FailingDataManager object at
0x317abd0>
Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 444, in _commitResources
    rm.tpc_begin(self)
  File "<doctest
transaction.tests.test_transaction.test_addAfterCommitHook[29]>", line
3, in tpc_begin
    raise CommitFailure
transaction.tests.test_transaction.CommitFailure

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 487, in _cleanup
    rm.tpc_abort(self)
AttributeError: 'FailingDataManager' object has no attribute 'tpc_abort'
Error in after commit hook exec in <function hookRaise at 0x3178d10> 
Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 419, in _callAfterCommitHooks
    hook(status, *args, **kws)
  File "<doctest
transaction.tests.test_transaction.test_addAfterCommitHook[52]>", line
2, in hookRaise
    raise TypeError("Fake raise")
TypeError: Fake raise
FError in tpc_abort() on manager
<transaction.tests.test_transaction.FailingDataManager object at
0x31832d0>
Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 444, in _commitResources
    rm.tpc_begin(self)
  File "<doctest
transaction.tests.test_transaction.test_addBeforeCommitHook[29]>", line
3, in tpc_begin
    raise CommitFailure
transaction.tests.test_transaction.CommitFailure

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 487, in _cleanup
    rm.tpc_abort(self)
AttributeError: 'FailingDataManager' object has no attribute 'tpc_abort'
F.Failed to abort resource manager: <BasicJar 31833D0 ('abort',)>
Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 506, in abort
    rm.abort(self)
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
318, in abort
    self.check('abort')
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
313, in check
    raise TestTxnException("error %s" % method)
transaction.tests.test_transaction.TestTxnException: error abort
..Error in tpc_abort() on manager <BasicJar 3183E50 ('tpc_abort',
'tpc_vote')>
Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 449, in _commitResources
    rm.tpc_vote(self)
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
330, in tpc_vote
    self.check('tpc_vote')
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
313, in check
    raise TestTxnException("error %s" % method)
transaction.tests.test_transaction.TestTxnException: error tpc_vote

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 487, in _cleanup
    rm.tpc_abort(self)
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
334, in tpc_abort
    self.check('tpc_abort')
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
313, in check
    raise TestTxnException("error %s" % method)
transaction.tests.test_transaction.TestTxnException: error tpc_abort
..............Error in tpc_abort() on manager {'name': 'bob'}
Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 690, in __init__
    savepoint = datamanager.savepoint
AttributeError: 'SampleDataManager' object has no attribute 'savepoint'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 260, in savepoint
    savepoint = Savepoint(self, optimistic, *self._resources)
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 693, in __init__
    raise TypeError("Savepoints unsupported", datamanager)
TypeError: ('Savepoints unsupported', {'name': 'bob'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 487, in _cleanup
    rm.tpc_abort(self)
  File
"/home/chrism/projects/transaction/transaction/tests/savepointsample.py", line 
143, in tpc_abort
    assert transaction is self.transaction, "Must not change
transactions"
AssertionError: Must not change transactions
Error in tpc_abort() on manager {'name': 'sue'}
Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 690, in __init__
    savepoint = datamanager.savepoint
AttributeError: 'SampleDataManager' object has no attribute 'savepoint'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 260, in savepoint
    savepoint = Savepoint(self, optimistic, *self._resources)
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 693, in __init__
    raise TypeError("Savepoints unsupported", datamanager)
TypeError: ('Savepoints unsupported', {'name': 'sue'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 487, in _cleanup
    rm.tpc_abort(self)
  File
"/home/chrism/projects/transaction/transaction/tests/savepointsample.py", line 
143, in tpc_abort
    assert transaction is self.transaction, "Must not change
transactions"
AssertionError: Must not change transactions
Error in tpc_abort() on manager {'sally-credit': 100.0, 'bob-credit':
0.0, 'name': 'bob', 'bob-balance': 0.0, 'sally-balance': 0.0}
Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 690, in __init__
    savepoint = datamanager.savepoint
AttributeError: 'SampleDataManager' object has no attribute 'savepoint'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 260, in savepoint
    savepoint = Savepoint(self, optimistic, *self._resources)
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 693, in __init__
    raise TypeError("Savepoints unsupported", datamanager)
TypeError: ('Savepoints unsupported', {'name': 'sue'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chrism/projects/transaction/transaction/_transaction.py",
line 487, in _cleanup
    rm.tpc_abort(self)
  File
"/home/chrism/projects/transaction/transaction/tests/savepointsample.py", line 
143, in tpc_abort
    assert transaction is self.transaction, "Must not change
transactions"
AssertionError: Must not change transactions
F../home/chrism/projects/transaction/transaction/tests/test_weakset.py:59: 
DeprecationWarning: Please use assertTrue instead.
  self.assert_(list, type(L))
...............
======================================================================
FAIL: /home/chrism/projects/transaction/transaction/tests/doom.txt
Doctest: doom.txt
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/chrism/opt/Python-3.2/lib/python3.2/doctest.py", line
2113, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for doom.txt
  File "/home/chrism/projects/transaction/transaction/tests/doom.txt",
line 0

----------------------------------------------------------------------
File "/home/chrism/projects/transaction/transaction/tests/doom.txt",
line 80, in doom.txt
Failed example:
    txn.commit() # doctest: +IGNORE_EXCEPTION_DETAIL
Expected:
    Traceback (most recent call last):
    DoomedTransaction
Got:
    Traceback (most recent call last):
      File "/home/chrism/opt/Python-3.2/lib/python3.2/doctest.py", line
1248, in __run
        compileflags, 1), test.globs)
      File "<doctest doom.txt[12]>", line 1, in <module>
        txn.commit() # doctest: +IGNORE_EXCEPTION_DETAIL
      File
"/home/chrism/projects/transaction/transaction/_transaction.py", line
318, in commit
        raise interfaces.DoomedTransaction()
    transaction.interfaces.DoomedTransaction
----------------------------------------------------------------------
File "/home/chrism/projects/transaction/transaction/tests/doom.txt",
line 83, in doom.txt
Failed example:
    txn.commit() # doctest: +IGNORE_EXCEPTION_DETAIL
Expected:
    Traceback (most recent call last):
    DoomedTransaction
Got:
    Traceback (most recent call last):
      File "/home/chrism/opt/Python-3.2/lib/python3.2/doctest.py", line
1248, in __run
        compileflags, 1), test.globs)
      File "<doctest doom.txt[13]>", line 1, in <module>
        txn.commit() # doctest: +IGNORE_EXCEPTION_DETAIL
      File
"/home/chrism/projects/transaction/transaction/_transaction.py", line
318, in commit
        raise interfaces.DoomedTransaction()
    transaction.interfaces.DoomedTransaction


======================================================================
FAIL: test_addAfterCommitHook (transaction.tests.test_transaction)
Doctest: transaction.tests.test_transaction.test_addAfterCommitHook
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/chrism/opt/Python-3.2/lib/python3.2/doctest.py", line
2113, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for
transaction.tests.test_transaction.test_addAfterCommitHook
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
529, in test_addAfterCommitHook

----------------------------------------------------------------------
File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
612, in transaction.tests.test_transaction.test_addAfterCommitHook
Failed example:
    t.commit() #doctest +IGNORE_EXCEPTION_DETAIL
Expected:
    Traceback (most recent call last):
    ...
    CommitFailure
Got:
    Traceback (most recent call last):
      File "/home/chrism/opt/Python-3.2/lib/python3.2/doctest.py", line
1248, in __run
        compileflags, 1), test.globs)
      File "<doctest
transaction.tests.test_transaction.test_addAfterCommitHook[33]>", line
1, in <module>
        t.commit() #doctest +IGNORE_EXCEPTION_DETAIL
      File
"/home/chrism/projects/transaction/transaction/_transaction.py", line
341, in commit
        reraise(t, v, tb)
      File "/home/chrism/projects/transaction/transaction/compat.py",
line 60, in reraise
        raise value
      File
"/home/chrism/projects/transaction/transaction/_transaction.py", line
332, in commit
        self._commitResources()
      File
"/home/chrism/projects/transaction/transaction/_transaction.py", line
472, in _commitResources
        reraise(t, v, tb)
      File "/home/chrism/projects/transaction/transaction/compat.py",
line 60, in reraise
        raise value
      File
"/home/chrism/projects/transaction/transaction/_transaction.py", line
444, in _commitResources
        rm.tpc_begin(self)
      File "<doctest
transaction.tests.test_transaction.test_addAfterCommitHook[29]>", line
3, in tpc_begin
        raise CommitFailure
    transaction.tests.test_transaction.CommitFailure


======================================================================
FAIL: test_addBeforeCommitHook (transaction.tests.test_transaction)
Doctest: transaction.tests.test_transaction.test_addBeforeCommitHook
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/chrism/opt/Python-3.2/lib/python3.2/doctest.py", line
2113, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for
transaction.tests.test_transaction.test_addBeforeCommitHook
  File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
391, in test_addBeforeCommitHook

----------------------------------------------------------------------
File
"/home/chrism/projects/transaction/transaction/tests/test_transaction.py", line 
474, in transaction.tests.test_transaction.test_addBeforeCommitHook
Failed example:
    t.commit() #doctest +IGNORE_EXCEPTION_DETAIL
Expected:
    Traceback (most recent call last):
    ...
    CommitFailure
Got:
    Traceback (most recent call last):
      File "/home/chrism/opt/Python-3.2/lib/python3.2/doctest.py", line
1248, in __run
        compileflags, 1), test.globs)
      File "<doctest
transaction.tests.test_transaction.test_addBeforeCommitHook[33]>", line
1, in <module>
        t.commit() #doctest +IGNORE_EXCEPTION_DETAIL
      File
"/home/chrism/projects/transaction/transaction/_transaction.py", line
341, in commit
        reraise(t, v, tb)
      File "/home/chrism/projects/transaction/transaction/compat.py",
line 60, in reraise
        raise value
      File
"/home/chrism/projects/transaction/transaction/_transaction.py", line
332, in commit
        self._commitResources()
      File
"/home/chrism/projects/transaction/transaction/_transaction.py", line
472, in _commitResources
        reraise(t, v, tb)
      File "/home/chrism/projects/transaction/transaction/compat.py",
line 60, in reraise
        raise value
      File
"/home/chrism/projects/transaction/transaction/_transaction.py", line
444, in _commitResources
        rm.tpc_begin(self)
      File "<doctest
transaction.tests.test_transaction.test_addBeforeCommitHook[29]>", line
3, in tpc_begin
        raise CommitFailure
    transaction.tests.test_transaction.CommitFailure


======================================================================
FAIL: /home/chrism/projects/transaction/transaction/tests/savepoint.txt
Doctest: savepoint.txt
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/chrism/opt/Python-3.2/lib/python3.2/doctest.py", line
2113, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for savepoint.txt
  File
"/home/chrism/projects/transaction/transaction/tests/savepoint.txt",
line 0

----------------------------------------------------------------------
File
"/home/chrism/projects/transaction/transaction/tests/savepoint.txt",
line 187, in savepoint.txt
Failed example:
    savepoint2.rollback() #doctest: +IGNORE_EXCEPTION_DETAIL
Expected:
    Traceback (most recent call last):
    ...
    InvalidSavepointRollbackError
Got:
    Traceback (most recent call last):
      File "/home/chrism/opt/Python-3.2/lib/python3.2/doctest.py", line
1248, in __run
        compileflags, 1), test.globs)
      File "<doctest savepoint.txt[47]>", line 1, in <module>
        savepoint2.rollback() #doctest: +IGNORE_EXCEPTION_DETAIL
      File
"/home/chrism/projects/transaction/transaction/_transaction.py", line
703, in rollback
        raise interfaces.InvalidSavepointRollbackError
    transaction.interfaces.InvalidSavepointRollbackError
----------------------------------------------------------------------
File
"/home/chrism/projects/transaction/transaction/tests/savepoint.txt",
line 192, in savepoint.txt
Failed example:
    savepoint1.rollback() #doctest: +IGNORE_EXCEPTION_DETAIL
Expected:
    Traceback (most recent call last):
    ...
    InvalidSavepointRollbackError
Got:
    Traceback (most recent call last):
      File "/home/chrism/opt/Python-3.2/lib/python3.2/doctest.py", line
1248, in __run
        compileflags, 1), test.globs)
      File "<doctest savepoint.txt[48]>", line 1, in <module>
        savepoint1.rollback() #doctest: +IGNORE_EXCEPTION_DETAIL
      File
"/home/chrism/projects/transaction/transaction/_transaction.py", line
703, in rollback
        raise interfaces.InvalidSavepointRollbackError
    transaction.interfaces.InvalidSavepointRollbackError


----------------------------------------------------------------------
Ran 53 tests in 0.063s

FAILED (failures=4)
[chrism@thinko transaction]$ 
"""


_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to