[1.7.x] Fixed #22661 -- Move makemigrations tests to the proper class
Backport of 44304cf04e
from master
This commit is contained in:
parent
0fa1aeb8d8
commit
f7270dcd9d
|
@ -85,28 +85,6 @@ class MigrateTests(MigrationTestBase):
|
|||
with self.assertRaises(CommandError):
|
||||
call_command("migrate", "migrations")
|
||||
|
||||
@override_system_checks([])
|
||||
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_conflict"})
|
||||
def test_makemigrations_conflict_exit(self):
|
||||
"""
|
||||
Makes sure that makemigrations exits if it detects a conflict.
|
||||
"""
|
||||
with self.assertRaises(CommandError):
|
||||
call_command("makemigrations")
|
||||
|
||||
@override_system_checks([])
|
||||
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_conflict"})
|
||||
def test_makemigrations_merge_basic(self):
|
||||
"""
|
||||
Makes sure that makemigrations doesn't error if you ask for
|
||||
merge mode with a conflict present. Doesn't test writing of the merge
|
||||
file, as that requires temp directories.
|
||||
"""
|
||||
try:
|
||||
call_command("makemigrations", merge=True, verbosity=0)
|
||||
except CommandError:
|
||||
self.fail("Makemigrations errored in merge mode with conflicts")
|
||||
|
||||
@override_system_checks([])
|
||||
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"})
|
||||
def test_sqlmigrate(self):
|
||||
|
@ -211,3 +189,25 @@ class MakeMigrationsTests(MigrationTestBase):
|
|||
|
||||
initial_file = os.path.join(self.migration_dir, "0001_initial.py")
|
||||
self.assertFalse(os.path.exists(initial_file))
|
||||
|
||||
@override_system_checks([])
|
||||
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_conflict"})
|
||||
def test_makemigrations_conflict_exit(self):
|
||||
"""
|
||||
Makes sure that makemigrations exits if it detects a conflict.
|
||||
"""
|
||||
with self.assertRaises(CommandError):
|
||||
call_command("makemigrations")
|
||||
|
||||
@override_system_checks([])
|
||||
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_conflict"})
|
||||
def test_makemigrations_merge_basic(self):
|
||||
"""
|
||||
Makes sure that makemigrations doesn't error if you ask for
|
||||
merge mode with a conflict present. Doesn't test writing of the merge
|
||||
file, as that requires temp directories.
|
||||
"""
|
||||
try:
|
||||
call_command("makemigrations", merge=True, verbosity=0)
|
||||
except CommandError:
|
||||
self.fail("Makemigrations errored in merge mode with conflicts")
|
||||
|
|
Loading…
Reference in New Issue