diff options
| author | Simon Charette <charette.s@gmail.com> | 2016-08-26 14:04:12 -0700 |
|---|---|---|
| committer | Simon Charette <charette.s@gmail.com> | 2016-08-30 19:50:42 -0400 |
| commit | 0d7929266ec9d8f6bcf9e41a40b281259cba6a79 (patch) | |
| tree | 46f8d6e319a5c3de5e1709b33acd738d5b1618f5 /tests/migrations/test_loader.py | |
| parent | a72411e140a886bdadbc666f9921c32b7aaed754 (diff) | |
Fixed #25109 -- Stopped silencing explicitly specified migration modules import errors.
Thanks Tim for the review.
Diffstat (limited to 'tests/migrations/test_loader.py')
| -rw-r--r-- | tests/migrations/test_loader.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/migrations/test_loader.py b/tests/migrations/test_loader.py index b8c2cd8142..5b31fcbd2c 100644 --- a/tests/migrations/test_loader.py +++ b/tests/migrations/test_loader.py @@ -205,6 +205,22 @@ class LoaderTests(TestCase): self.assertEqual(migration_loader.migrated_apps, set()) self.assertEqual(migration_loader.unmigrated_apps, {'migrated_app'}) + @override_settings( + INSTALLED_APPS=['migrations.migrations_test_apps.migrated_app'], + MIGRATION_MODULES={'migrated_app': 'missing-module'}, + ) + def test_explicit_missing_module(self): + """ + If a MIGRATION_MODULES override points to a missing module, the error + raised during the importation attempt should be propagated unless + `ignore_no_migrations=True`. + """ + with self.assertRaisesMessage(ImportError, 'missing-module'): + migration_loader = MigrationLoader(connection) + migration_loader = MigrationLoader(connection, ignore_no_migrations=True) + self.assertEqual(migration_loader.migrated_apps, set()) + self.assertEqual(migration_loader.unmigrated_apps, {'migrated_app'}) + @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_squashed"}) def test_loading_squashed(self): "Tests loading a squashed migration" |
