From 984531f96eb901f2dca732087171bfe8ced986c3 Mon Sep 17 00:00:00 2001 From: Cristobal Mackenzie Date: Wed, 26 Feb 2020 18:07:17 -0300 Subject: Fixed #31314 -- Raised CommandError when locale is not specified in makemessages. Regression in 0707b824fe77e08ca8b75fcc3738ada694f2a3a6. --- tests/i18n/test_extraction.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py index 709a6133f5..5d6d00fcef 100644 --- a/tests/i18n/test_extraction.py +++ b/tests/i18n/test_extraction.py @@ -142,6 +142,16 @@ class BasicExtractorTests(ExtractorTests): self.assertIn('#. Translators: One-line translator comment #1', po_contents) self.assertIn('msgctxt "Special trans context #1"', po_contents) + def test_no_option(self): + # One of either the --locale, --exclude, or --all options is required. + msg = "Type 'manage.py help makemessages' for usage information." + with mock.patch( + 'django.core.management.commands.makemessages.sys.argv', + ['manage.py', 'makemessages'], + ): + with self.assertRaisesRegex(CommandError, msg): + management.call_command('makemessages') + def test_comments_extractor(self): management.call_command('makemessages', locale=[LOCALE], verbosity=0) self.assertTrue(os.path.exists(self.PO_FILE)) -- cgit v1.3