data migration - How to unit test a Django South "datamigration" -
i created data migration using south, takes versions table , converts from:
major: 1, minor: 2, micro: 3, release:
into simpler:
name: 1.2.3.a
now want test datamigration using django unit testing (1.3beta).
how can use south programatically roll migrations forward , backward while specifying custom fixtures use can validate?
i've asked question on django south irc didn't answer; did make me question "why" of unit testing data migrations (since it's 1 time thing , you're not going refactor anyway, might manual checks).
however, found 2 reasons to "real testing":
- writing assumptions down beforehand forces me explicit, hence more correct.
- i can read assumptions in place other actual code (which complicated rather large datamigration)
in end decided on tacking on number of assertions (i.e. regular python statement) @ end of datamigration. has advantages mentioned above, , additional advantage of doing rollback if 1 of assertions fails , telling part of reality not expected be.
Comments
Post a Comment