it's kind of a PITA but in Openstack we have fixtures which actually run all the alembic (or sqlalchemy-migrate) migrations on a new database. Some of the more ambitious projects even write unit tests in between each migration that use inspect() to check that the database state is what's expected.
so to do things like that, you need a fixture which can: 1. create a new database (you probably need to produce a randomized name for concurrency) 2. invoke alembic to each revision individually (you can do this through alembic API: http://alembic.zzzcomputing.com/en/latest/api/commands.html 3. have a dispatch which can call upon test cases linked to that rev, like "def test_aabbccddee_does_thing_one()" 4. drops the database and...that's how you do it ! On Thu, Nov 30, 2017 at 1:54 PM, Chris Withers <ch...@simplistix.co.uk> wrote: > Hi All, > > How would I add test coverage for this sort of code? > > https://coveralls.io/builds/14408741/source?filename=mortar_mixins%2Fmigrations.py > > 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.