summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2021-10-12 15:12:29 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-10-15 06:59:31 +0200
commit15683cdb95eb471f801bd15aca47348f9bb6cba5 (patch)
treec1f2cca91ffe911697ef0d37d937723af14042fe /tests
parent6e4ac28af0ce52f770d62e6dcda29bc9dda713af (diff)
Fixed #23953 -- Made makemigrations continue number sequence for squashed migrations.
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_autodetector.py6
-rw-r--r--tests/migrations/test_commands.py15
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py
index 0f1f4b5102..ed2398ebaf 100644
--- a/tests/migrations/test_autodetector.py
+++ b/tests/migrations/test_autodetector.py
@@ -2670,6 +2670,12 @@ class AutodetectorTests(TestCase):
('0001_initial', 1),
('0002_model3', 2),
('0002_auto_20380101_1112', 2),
+ ('0002_squashed_0003', 3),
+ ('0002_model2_squashed_0003_other4', 3),
+ ('0002_squashed_0003_squashed_0004', 4),
+ ('0002_model2_squashed_0003_other4_squashed_0005_other6', 5),
+ ('0002_custom_name_20380101_1112_squashed_0003_model', 3),
+ ('2_squashed_4', 4),
]
for migration_name, expected_number in tests:
with self.subTest(migration_name=migration_name):
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
index 7b173c68bc..02e2a1ee11 100644
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -1956,6 +1956,21 @@ class MakeMigrationsTests(MigrationTestBase):
out_value = out.getvalue()
self.assertIn('Add field created to book', out_value)
+ @override_settings(
+ MIGRATION_MODULES={'migrations': 'migrations.test_migrations_squashed'},
+ )
+ def test_makemigrations_continues_number_sequence_after_squash(self):
+ with self.temporary_migration_module(module='migrations.test_migrations_squashed'):
+ with captured_stdout() as out:
+ call_command(
+ 'makemigrations',
+ 'migrations',
+ interactive=False,
+ empty=True,
+ )
+ out_value = out.getvalue()
+ self.assertIn('0003_auto', out_value)
+
class SquashMigrationsTests(MigrationTestBase):
"""