Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #21014 -- Fixed gobbled ImportError in MigrationLoader.

  • Loading branch information...
commit 82bbb9fe812ac2a575bf1291055093adfb9b8fff 1 parent 4d13cc5
Loïc Bistuer loic authored timgraham committed
1  django/db/migrations/loader.py
View
@@ -63,6 +63,7 @@ def load_disk(self):
if "No module named" in str(e) and "migrations" in str(e):
self.unmigrated_apps.add(app_label)
continue
+ raise
self.migrated_apps.add(app_label)
directory = os.path.dirname(module.__file__)
# Scan for .py[c|o] files
1  tests/migrations/faulty_migrations/import_error/__init__.py
View
@@ -0,0 +1 @@
+import fake_python_module
7 tests/migrations/test_loader.py
View
@@ -77,3 +77,10 @@ def test_name_match(self):
migration_loader.get_migration_by_prefix("migrations", "0")
with self.assertRaises(KeyError):
migration_loader.get_migration_by_prefix("migrations", "blarg")
+
+ def test_load_import_error(self):
+ migration_loader = MigrationLoader(connection)
+
+ with override_settings(MIGRATION_MODULES={"migrations": "migrations.faulty_migrations.import_error"}):
+ with self.assertRaises(ImportError):
+ migration_loader.load_disk()
Please sign in to comment.
Something went wrong with that request. Please try again.