mirror of https://github.com/django/django.git
Fixed #21014 -- Fixed gobbled ImportError in MigrationLoader.
This commit is contained in:
parent
4d13cc56de
commit
82bbb9fe81
|
@ -63,6 +63,7 @@ class MigrationLoader(object):
|
|||
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
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
import fake_python_module
|
|
@ -77,3 +77,10 @@ class LoaderTests(TestCase):
|
|||
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()
|
||||
|
|
Loading…
Reference in New Issue