diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2016-05-28 19:17:48 -0300 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-05-29 12:49:47 -0400 |
| commit | af8ac46015f5bbed7c266df0ff8490e05282ab59 (patch) | |
| tree | eb2b18467c1a7f4b51c55aafa051975af14c82a2 | |
| parent | e1401397240fe62c0cfadc778ae329b1d8c3e75e (diff) | |
[1.10.x] Fixed #26674 -- Corrected a i18n makemessages test.
Made it consistently read the PO file, decode its contents and then
check for the non-breaking space Unicode code point.
Previously we were erroneously skipping the interpretation of what we
read as UTF-8 text.
This was causing the test to fail on Windows with Python 3.5.
Backport of 1b00ed088073ffd268af15d25246d2565253536d from master
| -rw-r--r-- | tests/i18n/test_extraction.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py index 83fbeb5bd4..2c7e7ea6d0 100644 --- a/tests/i18n/test_extraction.py +++ b/tests/i18n/test_extraction.py @@ -214,9 +214,9 @@ class BasicExtractorTests(ExtractorTests): 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("Non-breaking space\xa0:", po_contents) + with io.open(self.PO_FILE, 'r', encoding='utf-8') as fp: + po_contents = fp.read() + self.assertMsgId("Non-breaking space\u00a0:", po_contents) def test_blocktrans_trimmed(self): os.chdir(self.test_dir) |
