From 07506a61147768b95e44ee68d0673851fa5e05bd Mon Sep 17 00:00:00 2001 From: davidchorpash Date: Sat, 6 Jun 2020 17:05:39 -0600 Subject: [PATCH] Fixed #31661 -- Removed period in makemigrations history check warning. --- django/core/management/commands/makemigrations.py | 2 +- tests/migrations/test_commands.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py index 709abaa8d6..c8c688ec94 100644 --- a/django/core/management/commands/makemigrations.py +++ b/django/core/management/commands/makemigrations.py @@ -104,7 +104,7 @@ class Command(BaseCommand): except OperationalError as error: warnings.warn( "Got an error checking a consistent migration history " - "performed for database connection '%s': %s." + "performed for database connection '%s': %s" % (alias, error), RuntimeWarning, ) diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py index 50f3ea8965..f7b21931e4 100644 --- a/tests/migrations/test_commands.py +++ b/tests/migrations/test_commands.py @@ -1566,8 +1566,9 @@ class MakeMigrationsTests(MigrationTestBase): side_effect=OperationalError('could not connect to server'), ): with self.temporary_migration_module(): - with self.assertWarnsMessage(RuntimeWarning, msg): + with self.assertWarns(RuntimeWarning) as cm: call_command('makemigrations', verbosity=0) + self.assertEqual(str(cm.warning), msg) @mock.patch('builtins.input', return_value='1') @mock.patch('django.db.migrations.questioner.sys.stdin', mock.MagicMock(encoding=sys.getdefaultencoding()))