Fixed #28913 -- Fixed error handling when MIGRATIONS_MODULES specifies a nonexistent top-level package.

This commit is contained in:
Sanket Saurav 2018-05-05 17:03:20 +05:30 committed by Tim Graham
parent 10b44e4525
commit 079f324357
3 changed files with 12 additions and 1 deletions

View file

@ -1116,6 +1116,16 @@ class MakeMigrationsTests(MigrationTestBase):
# Command output indicates the migration is created.
self.assertIn(" - Create model SillyModel", out.getvalue())
@override_settings(MIGRATION_MODULES={'migrations': 'some.nonexistent.path'})
def test_makemigrations_migrations_modules_nonexistent_toplevel_package(self):
msg = (
'Could not locate an appropriate location to create migrations '
'package some.nonexistent.path. Make sure the toplevel package '
'exists and can be imported.'
)
with self.assertRaisesMessage(ValueError, msg):
call_command('makemigrations', 'migrations', empty=True, verbosity=0)
def test_makemigrations_interactive_by_default(self):
"""
The user is prompted to merge by default if there are conflicts and