[TIP] loading test data into frameworks

Kumar McMillan kumar.mcmillan at gmail.com
Fri Jan 14 09:19:16 PST 2011


On Fri, Jan 14, 2011 at 8:23 AM, Chris Withers <chris at simplistix.co.uk> wrote:
>> [ please set  the reply-to to testing-in-python@ !]
>
> This is for the list manager. Some might just say "stop being lazy" ;-)

+1 (I can hear Titus grumble)

>
>>> http://www.simplistix.co.uk/software/python/testfixtures
...
> Maybe read a little before diving in at the deep end with your rant ;-)

"fixture" is an overloaded term in the testing world (hearing Titus
grumble again)

>> I was using farmdev's fixture system, and it was incredibly slow.

yep, I don't even use it anymore because the kind folks at Django have
spent a lot of their precious time optimizing the bajezus out of
Django's own fixture loading system.  It is lightning fast.


>> I rewrote the fixture loader, going direct to SQL, and got a major speed
>> boost.

but Django is not as fast as SQL!!

>
> Cool, did you feed it back to the original package so that everyone could
> benefit from your work?

yeah, this has been on the fixture module's wish list for quite some
time and I even have a branch laying around with a half-assed attempt
at it.  I would LOVE to receive a patch for raw SQL support and
preferably something that generated SQL in Postgres' COPY format when
relevant.

The code can be forked from here:
http://code.google.com/p/fixture/source/checkout

by the way, fixture is looking for a new maintainer.  I don't use it
enough in my daily projects anymore even though I still think it's a
pretty nice way to deal with data dependencies.  Testing with data has
a vast amount of problems and I welcome reasonable attempts to use
mock objects instead.  There is always a trade-off though and most
test suites (especially for web apps) benefit from tests that use
data.


Kumar



More information about the testing-in-python mailing list