mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #28913 -- Fixed error handling when MIGRATIONS_MODULES specifies a nonexistent top-level package.
This commit is contained in:
parent
10b44e4525
commit
079f324357
1
AUTHORS
1
AUTHORS
@ -722,6 +722,7 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
Ryno Mathee <rmathee@gmail.com>
|
Ryno Mathee <rmathee@gmail.com>
|
||||||
Sam Newman <http://www.magpiebrain.com/>
|
Sam Newman <http://www.magpiebrain.com/>
|
||||||
Sander Dijkhuis <sander.dijkhuis@gmail.com>
|
Sander Dijkhuis <sander.dijkhuis@gmail.com>
|
||||||
|
Sanket Saurav <sanketsaurav@gmail.com>
|
||||||
Sarthak Mehrish <sarthakmeh03@gmail.com>
|
Sarthak Mehrish <sarthakmeh03@gmail.com>
|
||||||
schwank@gmail.com
|
schwank@gmail.com
|
||||||
Scot Hacker <shacker@birdhouse.org>
|
Scot Hacker <shacker@birdhouse.org>
|
||||||
|
@ -240,7 +240,7 @@ class MigrationWriter:
|
|||||||
missing_dirs.insert(0, existing_dirs.pop(-1))
|
missing_dirs.insert(0, existing_dirs.pop(-1))
|
||||||
try:
|
try:
|
||||||
base_module = import_module(".".join(existing_dirs))
|
base_module = import_module(".".join(existing_dirs))
|
||||||
except ImportError:
|
except (ImportError, ValueError):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
@ -1116,6 +1116,16 @@ class MakeMigrationsTests(MigrationTestBase):
|
|||||||
# Command output indicates the migration is created.
|
# Command output indicates the migration is created.
|
||||||
self.assertIn(" - Create model SillyModel", out.getvalue())
|
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):
|
def test_makemigrations_interactive_by_default(self):
|
||||||
"""
|
"""
|
||||||
The user is prompted to merge by default if there are conflicts and
|
The user is prompted to merge by default if there are conflicts and
|
||||||
|
Loading…
Reference in New Issue
Block a user