Ñò 4äKc @ s+ d Z d d k Z d d k Z d d k Z d d k Z d d k l Z d e i d ƒ Z d „ Z d e i f d „ ƒ YZ d d d „ ƒ YZ d e f d „ ƒ YZ d d d „ ƒ YZ d e f d „ ƒ YZ d „ Z d „ Z d „ Z d „ Z d „ Z e Z e d j o e i ƒ i e ƒ ƒ n d S( s½ Test transaction behavior for variety of cases. I wrote these unittests to investigate some odd transaction behavior when doing unittests of integrating non sub transaction aware objects, and to insure proper txn behavior. these tests test the transaction system independent of the rest of the zodb. you can see the method calls to a jar by passing the keyword arg tracing to the modify method of a dataobject. the value of the arg is a prefix used for tracing print calls to that objects jar. the number of times a jar method was called can be inspected by looking at an attribute of the jar that is the method name prefixed with a c (count/check). i've included some tracing examples for tests that i thought were illuminating as doc strings below. TODO add in tests for objects which are modified multiple times, for example an object that gets modified in multiple sub txns. $Id: test_transaction.py 112144 2010-05-07 15:35:15Z tseaver $ iÿÿÿÿN( t WarningsHooki t Pc C s? t | ƒ } | d j o" | t 7} | d j p t ‚ n | S( s) Return id(obj) as a non-negative integer.i ( t idt _ADDRESS_MASKt AssertionError( t objt result( ( sF /usr/lib/python2.6/site-packages/transaction/tests/test_transaction.pyt positive_id2 s t TransactionTestsc B sk e Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( c C sY t i ƒ } | _ t | ƒ | _ t | ƒ | _ t | ƒ | _ t | d d ƒ| _ d S( Nt nosti ( t transactiont TransactionManagert transaction_managert DataObjectt sub1t sub2t sub3t nosub1( t selft mgr( ( sF /usr/lib/python2.6/site-packages/transaction/tests/test_transaction.pyt setUp= s c C se | i i ƒ | i i ƒ | i i ƒ | i i i d j p t ‚ | i i i d j p t ‚ d S( Ni i ( R t modifyR R t committ _p_jart ccommit_subR t ctpc_finish( R ( ( sF /usr/lib/python2.6/site-packages/transaction/tests/test_transaction.pyt testTransactionCommitG s c C sH | i i ƒ | i i ƒ | i i ƒ | i i i d j p t ‚ d S( Ni ( R R R R t abortR t cabortR ( R ( ( sF /usr/lib/python2.6/site-packages/transaction/tests/test_transaction.pyt testTransactionAbortQ s c C s] | i i ƒ } | i d ƒ | i | i d ƒ | i d ƒ | i | i d ƒ | i ƒ d S( Ns This is a note.s Another.s This is a note. Another.( R t gett notet assertEqualt descriptionR ( R t t( ( sF /usr/lib/python2.6/site-packages/transaction/tests/test_transaction.pyt testTransactionNoteZ s c C s; | i i ƒ | i i ƒ | i i i d j p t ‚ d S( Ni ( R R R R R R R ( R ( ( sF /usr/lib/python2.6/site-packages/transaction/tests/test_transaction.pyt testNSJTransactionCommith s c C sX | i i ƒ | i i ƒ | i i i d j p t ‚ | i i i d j p t ‚ d S( Ni i ( R R R R R R R R ( R ( ( sF /usr/lib/python2.6/site-packages/transaction/tests/test_transaction.pyt testNSJTransactionAbortp s c C s§ t d d ƒ | i _ | i i ƒ | i i d d ƒ | i i ƒ y | i i ƒ Wn t j o n X| i i i d j p t ‚ | i i i d j p t ‚ d S( Nt errorsR t nojari ( t BasicJarR R R R R R R t TestTxnExceptionR R ( R ( ( sF /usr/lib/python2.6/site-packages/transaction/tests/test_transaction.pyt testExceptionInAbort„ s c C s· t d d ƒ | i _ | i i ƒ | i i d d ƒ y | i i ƒ Wn t j o n X| i i i d j p t ‚ | i i i d j p t ‚ | i i i d j p t ‚ d S( NR&