On Fri, 16 Jun 2006 16:34:03 -0500
"Bill Woodward" <[EMAIL PROTECTED]> wrote:

> Howdy,
> 
> I've been running into some odd/unexpected behavior while trying to
> write and run some controller unit tests with TG 0.9.  I've been
> writing a testcase class that inherits from testutil.DBTest so I can
> set up some objects in the database and then use them within the
> controller test.  What I've found doing this is that I have to create
> a new set of objects, with different searchable values, for each
> test.  If I didn't do that, the old version of the object would get
> used, and values that I set in the object cretion would not be
> available.
> 
> This actually seems to be odd behavior to me.  I would actually expect
> values in the database to *not* persist between tests.  I've
> extracted some of the DBTest code into my own DBTest class and added
> code in the tearDown method to drop the tables that are used in the
> tests, so that the in-memory tables get recreated each time.

It is odd behavior.  When I first wrote the DBTest class, I meant for
it to do that.  It looks like, in more cases than not, sqlite flubs
transactions.

I believe you're seeing this problem because the transaction is
commited by the auto-commit after a request is done.

I agree that dropping the tables is a really clean way to do it.

Because this is the way that DBTest is really supposed to work and I
don't know if anyone actually depends on the old, broken method, I vote
this gets added before 1.0.  Strictly speaking, I don't know if it's
considered an API change.

Jason

Attachment: signature.asc
Description: PGP signature

Reply via email to