Hi Tom,

When you say "testing migrations", what do you mean exactly? The migration
framework itself is heavily unit-tested, so I presume you intend to test
things like custom RunPython function bodies and the like?

Andrew

On Thu, May 7, 2015 at 3:30 AM, Tom Linford <[email protected]> wrote:

> At Robinhood, we've been using a custom in-house MigrationTestCase for
> testing migrations that we'd like to contribute, but want to check the API
> of it before contributing it. Here's the definition of the class:
>
> class MigrationTestCase(TransactionTestCase):
>     """
>     app_label: name of app (ie. "users" or "polls")
>     (start|dest)_migration_name: name of migration in app
>         (e.g. "0001_initial")
>     additional_dependencies: list of tuples of `(app_label,
> migration_name)`.
>         Add any additional migrations here that need to be included in the
>         generation of the model states.
>
>     Usage:
>
>     class TestCase(MigrationTestCase):
>         app_label = ...
>         start_migration_name = ...
>         dest_migration_name = ...
>         additional_dependencies = ...
>
>         def setUp(self):
>             # Create models with regular orm
>             super(TestCase, self).setUp()
>             # Create models with start orm. Access model with:
>             # self.start_models["<app_label>"]["<model_name>"]
>             # Note that model_name must be all lower case, you can just do:
>             # <instance>._meta.model_name to get the model_name
>
>         def test(self):
>             # Still using start orm
>             self.migrate_to_dest()
>             # Now, you can access dest models with:
>             # self.dest_models["<app_label>"]["<model_name>"]
>     """
>     app_label = None
>     start_migration_name = None
>     dest_migration_name = None
>     additional_dependencies = []
>
>
> Let me know if this API is agreeable and I can make a PR for this feature.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/8818bf72-aa66-4351-9177-e6e0f6605386%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/8818bf72-aa66-4351-9177-e6e0f6605386%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFwN1upE86dz%3DCHsKx%3DEh%2BdnXe%3DEHd3p9ba_GL4SZCYWDF8o6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to