Changes between Initial Version and Version 8 of Ticket #241


Ignore:
Timestamp:
Apr 7, 2012, 10:13:59 PM (13 years ago)
Author:
Christopher Allan Webber
Comment:

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! :)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #241

    • Property Keywords post-sql added
    • Property Milestone 0.2.1
    • Property Resolutionwontfix
    • Property Status acceptedclosed