1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #31700 -- Made makemigrations command display meaningful symbols for each operation.

This commit is contained in:
Amir Karimi
2023-09-16 05:41:22 +03:30
committed by Mariusz Felisiak
parent c7e986fc9f
commit 27a3eee721
14 changed files with 214 additions and 19 deletions

View File

@@ -2141,7 +2141,7 @@ class MakeMigrationsTests(MigrationTestBase):
)
# Normal --dry-run output
self.assertIn("- Add field silly_char to sillymodel", out.getvalue())
self.assertIn("+ Add field silly_char to sillymodel", out.getvalue())
# Additional output caused by verbosity 3
# The complete migrations file that would be written
@@ -2171,7 +2171,7 @@ class MakeMigrationsTests(MigrationTestBase):
)
initial_file = os.path.join(migration_dir, "0001_initial.py")
self.assertEqual(out.getvalue(), f"{initial_file}\n")
self.assertIn(" - Create model ModelWithCustomBase\n", err.getvalue())
self.assertIn(" + Create model ModelWithCustomBase\n", err.getvalue())
@mock.patch("builtins.input", return_value="Y")
def test_makemigrations_scriptable_merge(self, mock_input):
@@ -2216,7 +2216,7 @@ class MakeMigrationsTests(MigrationTestBase):
self.assertTrue(os.path.exists(initial_file))
# 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):
@@ -2321,12 +2321,12 @@ class MakeMigrationsTests(MigrationTestBase):
out.getvalue().lower(),
"merging conflicting_app_with_dependencies\n"
" branch 0002_conflicting_second\n"
" - create model something\n"
" + create model something\n"
" branch 0002_second\n"
" - delete model tribble\n"
" - remove field silly_field from author\n"
" - add field rating to author\n"
" - create model book\n"
" + add field rating to author\n"
" + create model book\n"
"\n"
"merging will only work if the operations printed above do not "
"conflict\n"