Fixed #31661 -- Removed period in makemigrations history check warning.

This commit is contained in:
davidchorpash 2020-06-06 17:05:39 -06:00 committed by Mariusz Felisiak
parent 38a21f2d9e
commit 07506a6114
2 changed files with 3 additions and 2 deletions

View File

@ -104,7 +104,7 @@ class Command(BaseCommand):
except OperationalError as error: except OperationalError as error:
warnings.warn( warnings.warn(
"Got an error checking a consistent migration history " "Got an error checking a consistent migration history "
"performed for database connection '%s': %s." "performed for database connection '%s': %s"
% (alias, error), % (alias, error),
RuntimeWarning, RuntimeWarning,
) )

View File

@ -1566,8 +1566,9 @@ class MakeMigrationsTests(MigrationTestBase):
side_effect=OperationalError('could not connect to server'), side_effect=OperationalError('could not connect to server'),
): ):
with self.temporary_migration_module(): with self.temporary_migration_module():
with self.assertWarnsMessage(RuntimeWarning, msg): with self.assertWarns(RuntimeWarning) as cm:
call_command('makemigrations', verbosity=0) call_command('makemigrations', verbosity=0)
self.assertEqual(str(cm.warning), msg)
@mock.patch('builtins.input', return_value='1') @mock.patch('builtins.input', return_value='1')
@mock.patch('django.db.migrations.questioner.sys.stdin', mock.MagicMock(encoding=sys.getdefaultencoding())) @mock.patch('django.db.migrations.questioner.sys.stdin', mock.MagicMock(encoding=sys.getdefaultencoding()))