hi chris, here’s how we do it in all our projects:
https://github.com/pyfidelity/rest-seed/blob/master/backend/backrest/tests/test_migrations.py basically, our migrations start with an empty database, so we run them, dump the resulting SQL, then create a new database using the `metadata.create_all` feature and then normalize the results and compare. if there is a mismatch the test fails. if you want to write more elaborate tests involving actual data, this should be a good starting point, though HTH, tom > On 23 Nov 2016, at 10:15, Chris Withers <ch...@simplistix.co.uk> wrote: > > Hi All, > > How do you go about writing automated tests for a migration? > > I don't often do this, but when migrations involve data, I prefer to but now > I don't know how ;-) > There's nothing in the docs, right? (or am I missing something obvious) > > cheers, > > Chris > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy-alembic" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy-alembic+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Message signed with OpenPGP using GPGMail