Re: unit testing migration code

2017-12-15 Thread Mike Bayer
don't think so but haven't looked. We have a fixture in Openstack
that does that kind of thing, but it's not non-openstack friendly.   I
think you've found your next project!


On Fri, Dec 15, 2017 at 1:42 AM, Chris Withers  wrote:
> Has anyone done anything like an equivalent of the following but for
> Alembic?
>
> https://github.com/plumdog/django_migration_testcase
>
> cheers,
>
> Chris
>
>
> On 01/12/2017 15:06, Mike Bayer wrote:
>>
>> 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 
>> 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.


Re: unit testing migration code

2017-12-14 Thread Chris Withers
Has anyone done anything like an equivalent of the following but for 
Alembic?


https://github.com/plumdog/django_migration_testcase

cheers,

Chris

On 01/12/2017 15:06, Mike Bayer wrote:

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  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.