summaryrefslogtreecommitdiff
path: root/tests/i18n/test_extraction.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-04-28 21:18:55 +0200
committerClaude Paroz <claude@2xlibre.net>2016-04-30 12:08:20 +0200
commitb16b124996b8f5c1f922cec688d32553b8ab94b8 (patch)
tree418913494c171e9484ceabbe5bc40e10ebd35d42 /tests/i18n/test_extraction.py
parent185f90c45f4398f186ee9dffe1c9bd7392a47686 (diff)
downloaddjango-b16b124996b8f5c1f922cec688d32553b8ab94b8.tar.gz
Fixed #26341 -- Fixed makemessages breaking location comments for HTML files
Thanks Sylvain Garancher for the report and Veranika Sabiashchanskaya for the initial patch.
Diffstat (limited to 'tests/i18n/test_extraction.py')
-rw-r--r--tests/i18n/test_extraction.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py
index bae2840934..83fbeb5bd4 100644
--- a/tests/i18n/test_extraction.py
+++ b/tests/i18n/test_extraction.py
@@ -649,8 +649,19 @@ class LocationCommentsTests(ExtractorTests):
# #16903 -- Standard comment with source file relative path should be present
self.assertLocationCommentPresent(self.PO_FILE, 'Translatable literal #6b', 'templates', 'test.html')
- # #21209 -- Leaky paths in comments on Windows e.g. #: path\to\file.html.py:123
- self.assertLocationCommentNotPresent(self.PO_FILE, None, 'templates', 'test.html.py')
+ def test_location_comments_for_templatized_files(self):
+ """
+ Ensure no leaky paths in comments, e.g. #: path\to\file.html.py:123
+ Refs #21209/#26341.
+ """
+ os.chdir(self.test_dir)
+ management.call_command('makemessages', locale=[LOCALE], verbosity=0)
+ self.assertTrue(os.path.exists(self.PO_FILE))
+ with open(self.PO_FILE, 'r') as fp:
+ po_contents = force_text(fp.read())
+ self.assertMsgId('#: templates/test.html.py', po_contents)
+ self.assertLocationCommentNotPresent(self.PO_FILE, None, '.html.py')
+ self.assertLocationCommentPresent(self.PO_FILE, 5, 'templates', 'test.html')
class KeepPotFileExtractorTests(ExtractorTests):