[Zope] FunctionalTestCase commits transactions
Ross Patterson
me at rpatterson.net
Wed Nov 5 14:45:18 EST 2008
"Peter Bengtsson" <peter at fry-it.com>
writes:
> 2008/11/4 Dieter Maurer <dieter at handshake.de>:
>> Ross Patterson wrote at 2008-11-3 16:04 -0800:
>>> ...
>>>If memory serves, a *functional* test fixture calls the Zope publisher
>>>when a testbrowser request is made. The publisher opens a new
>>>transaction, as it should.
>>
>> Really?
>>
>> 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?
> In fact I've already written a custom tearDown() for my class that
> cleans the test database (postgresql) which is quite neat because I
> can write tests in a completely different way as each test can build
> on each other (assuming order of methods is respected) similar to how
> doctests are done where you have blocks of shell code split between
> text.
>
> If this is the way it has to be to test with zope.testbrowser in zope
> 2 then I'll let it be so.
I don't think what Dieter is talking about is a viable path for you. I
think he's talking about something *else* that he did in the past. I
think you should use your approach or the one I suggested.
Ross
More information about the Zope
mailing list