[Zope] FunctionalTestCase commits transactions
Dieter Maurer
dieter at handshake.de
Mon Nov 17 02:35:37 EST 2008
Peter Bengtsson wrote at 2008-11-5 15:14 +0000:
> ...
>> When I wrote a functional test browser (years before "zope3"),
>> I emulated the Zope publisher rather than calling it directly
>> in order to have control how transactions are handled.
>>
>> Especially, I used subtransactions instead of top level transactions
>> to avoid the bug reported by Peter.
>>
>
>Uh? "subtransactions"?
>So how would you recommend that I go abouts doing this?
"savepoint"s have replaced subtransactions.
This means:
When a request starts, a new savepoint is created.
When the request would cause a transaction abort (in normal operation),
the test request will roll back to the saved savepoint. Otherwise,
the modifications are kept.
When the complete test ends, the transaction is aborted, wiping out
all modifications done be the test. Of course, this works only when
all resouce managers in the transaction support savepoints (which
probably means that all resource managers need to be ZODB connections).
--
Dieter
More information about the Zope
mailing list