On May 20, 12:03 am, Daniel Fetchinson <[email protected]>
wrote:

> > I don't want to manually wipe out all the entries because it is a
> > hassle to keep updating my teardown method after each new test. So,
> > how can I purge all the data quickly?
>
> And how about having a small in-memory database (sqlite does this, I'm
> not sure about the other backends) that completely gets wiped out
> after each test and gets recreated and repopulated before each test.


I am in the same shoes as the OP.

I use Postgres, and honestly, if my application (a management
control / hr stuff / etc) was simple enough to use sqlite as a
backend, I doubt I would be using a relational database at all.
Sometimes it's even an explicit suggestion from test-minded people, to
dumb down the database schema in order to make it more test friendly.
"and when the schema is dumb enough, we can support mysql too"... I'm
only half-joking, but many people are using an RDBMS like it was a
slow and cumbersome filesystem.

I'm not going to lose performance, scalability and increase the
complexity of the python side to have prettier and faster tests, no
thanks.

> Or this would take too long?

My DBTest class executes a TRUNCATE ALL followed by a fixture.sql
No schema changes between tests (applications don't need to change the
schema in day-to-day chores after all) but the tables are repopulated
once per model or functional test.

Since there are triggers, and integrity constraints must be tested
too, I decided early in the life of the project that ROLLBACK was not
enough, but I made it work with a previous release of TG.
If I remember correctly, switching from ROLLBACK to TRUNCATE slowed
tests by about 3x


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to