[1.7.x] Fixed #22661 -- Move makemigrations tests to the proper class

Backport of 44304cf04e from master
This commit is contained in:
Huu Nguyen 2014-05-19 20:16:36 -07:00 committed by Tim Graham
parent 0fa1aeb8d8
commit f7270dcd9d
1 changed files with 22 additions and 22 deletions

View File

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