#24759: MigrationTestCase
-----------------------------------+------------------------
     Reporter:  tomlinford         |      Owner:  nobody
         Type:  New feature        |     Status:  new
    Component:  Testing framework  |    Version:  1.8
     Severity:  Normal             |   Keywords:  migrations
 Triage Stage:  Unreviewed         |  Has patch:  0
Easy pickings:  0                  |      UI/UX:  0
-----------------------------------+------------------------
 At Robinhood, we've been using a custom in-house `MigrationTestCase` 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/24759>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.52488ced65d258efa234e9bbdfb66f61%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to