#241 closed defect (wontfix)
Test fixture support
Reported by: | Caleb Davis | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | programming | Keywords: | post-sql |
Cc: | Parent Tickets: |
Description (last modified by )
A few tickets are blocking on being able to rip test data into the database, and some giant put me on his shoulders and then I saw the promised land of test fixtures. We need to support test fixtures.
Change History (11)
comment:2 by , 13 years ago
2 would be fine I think. A thin wrapper around mongo{import/export} would seem to do the trick! =============================================================================================== `http://www.mongodb.org/display/DOCS/Import+Export+Tools#ImportExportTools-mongoimport <http://www.mongodb.org/display/DOCS/Import+Export+Tools#ImportExportTools-mongoimport>`_
comment:3 by , 13 years ago
Milestone: | 0.1.0 → 0.2.0 |
---|
comment:3 by , 13 years ago
A simple start: Creating the test user in the database. I factored that out into a tool function. My branch: ``misc/fixture_add_user``. If nobody cries "stupid idea" or "found a bug", I'll merge/push on sunday. Okay, merged. (commit ea5a5b15a3d5)
comment:4 by , 13 years ago
Milestone: | 0.2.0 → 0.2.1 |
---|
comment:4 by , 13 years ago
The requirements for this have massively changed now that we're moving to SQL, but I say "leave it open for now".
comment:5 by , 13 years ago
The original url for this bug was http://bugs.foocorp.net/issues/570 .
Relations:
#142: related, #55: related, #379: blocked
comment:6 by , 13 years ago
Keywords: | post-sql added |
---|
comment:7 by , 13 years ago
Milestone: | 0.2.1 |
---|
This will be interesting after sql lands.
sql hopefully lands in the next release.
So this will be after the next release, probably.
Of course, if someone wants to take it, go for it!
comment:8 by , 13 years ago
Description: | modified (diff) |
---|---|
Resolution: | → wontfix |
Status: | accepted → closed |
I'm going to kill this one.
I saw a talk at pycon that significantly convinced me that test fixtures are the wrong way to go. See:
http://www.youtube.com/watch?v=ickNQcNXiS4&feature=player_embedded
starting at 16:26
All sorts of reasons given for why this is bad!
Instead he suggests writing code like this:
def create_profile(**kwargs): defaults = { "likes_cheese": True, "age": 32, "address": "3815 Brookside Dr", } defaults.update(kwargs) if "user" not in defaults: defaults["user"] = create_user() return Profile.objects.create( **defaults)
and using that to *only* change the fields that you need to test for each thing you're trying out.
fixture_add_user() as elrond made above already pretty close to this.
Anyway, wontfix'ing my own bug! :)
comment:9 by , 13 years ago
I didn't even know this bug was around.
Erik Rose's talk at PyCon 2012 also talk about problems with testing using fixtures:
http://pyvideo.org/video/634/speedily-practical-large-scale-tests