{{{
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.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
The DevelopersMailingList is a better place to propose and get feedback on
features like this.
--
Ticket URL: <https://code.djangoproject.com/ticket/24759#comment:1>
* stage: Unreviewed => Accepted
Comment:
[https://groups.google.com/d/topic/django-
developers/181BkMhFUwo/discussion django-developers thread]
Accepting on the basis of some way to test data migrations.
--
Ticket URL: <https://code.djangoproject.com/ticket/24759#comment:2>