Fixed #21014 -- Fixed gobbled ImportError in MigrationLoader.

This commit is contained in:
Loic Bistuer 2013-09-06 03:51:11 +07:00 committed by Tim Graham
parent 4d13cc56de
commit 82bbb9fe81
3 changed files with 9 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1 @@
import fake_python_module

View File

@ -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()