Fixed #34052 -- Made migrate --check don't emit signals and output when up to date.

This commit is contained in:
JunKi Yoon 2022-09-27 21:10:18 +09:00 committed by Mariusz Felisiak
parent cff1f888e9
commit 1a7b6909ac
3 changed files with 46 additions and 10 deletions

View file

@ -156,3 +156,15 @@ class MigrateSignalTests(TransactionTestCase):
],
["migrate_signals.Signal"],
)
# Migrating with an empty plan and --check doesn't emit signals.
pre_migrate_receiver = Receiver(signals.pre_migrate)
post_migrate_receiver = Receiver(signals.post_migrate)
management.call_command(
"migrate",
database=MIGRATE_DATABASE,
verbosity=MIGRATE_VERBOSITY,
interactive=MIGRATE_INTERACTIVE,
check_unapplied=True,
)
self.assertEqual(pre_migrate_receiver.call_counter, 0)
self.assertEqual(post_migrate_receiver.call_counter, 0)