#31850 closed Cleanup/optimization (fixed)
test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails with xgettext 0.21.
| Reported by: | Michał Górny | Owned by: | Max Smolens |
|---|---|---|---|
| Component: | Testing framework | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
After upgrading system gettext to 0.21, the following test started to fail:
======================================================================
FAIL: test_extraction_warning (i18n.test_extraction.BasicExtractorTests)
test xgettext warning about multiple bare interpolation placeholders
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
yield
File "/usr/lib/python3.9/unittest/case.py", line 593, in run
self._callTestMethod(testMethod)
File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
method()
File "/tmp/django/tests/i18n/test_extraction.py", line 233, in test_extraction_warning
self.assertIn("code_sample.py:4", out.getvalue())
File "/usr/lib/python3.9/unittest/case.py", line 1098, in assertIn
self.fail(self._formatMessage(msg, standardMsg))
File "/usr/lib/python3.9/unittest/case.py", line 670, in fail
raise self.failureException(msg)
AssertionError: 'code_sample.py:4' not found in 'processing locale de\n'
I can reproduce the failure with django 2.2.15, 3.0.9 and git master (b68b8cb89abb35ff2152175ea540619ec384b1f4).
Change History (18)
comment:1 by , 5 years ago
| Component: | Uncategorized → Testing framework |
|---|---|
| Easy pickings: | set |
| Summary: | test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails with gettext-0.21 → test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails with xgettext 0.21. |
| Triage Stage: | Unreviewed → Accepted |
| Type: | Bug → Cleanup/optimization |
comment:2 by , 5 years ago
We should use a message that will cause a xgettext warning in all versions, see #18479.
comment:3 by , 5 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
I'll try to work on this issue.
comment:4 by , 5 years ago
| Owner: | removed |
|---|---|
| Status: | assigned → new |
I can also reproduce this error.
I looked a little bit into gettext's source code, under warn_format_string function in xg-message.c. Everything seems fine. I'm not sure why xgettext not giving this warning. I'll leave this to somebody with more experience.
comment:6 by , 5 years ago
Can someone above help me reproduce the error? Please let me know iraf333@…
comment:8 by , 5 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:9 by , 5 years ago
| Has patch: | set |
|---|
It looks like xgettext 0.21 has a bug where the "format string with unnamed arguments cannot be properly localized" warning is not displayed. I proposed a patch upstream and am awaiting confirmation from the maintainer.
Regardless, I created a patch to use a message that causes an xgettext warning in all versions, as suggested by comment:2.
follow-up: 17 comment:13 by , 5 years ago
Would it be possible to backport this into 2.2, 3.0 and 3.1 branches?
comment:17 by , 5 years ago
Replying to Michał Górny:
Would it be possible to backport this into 2.2, 3.0 and 3.1 branches?
Backported.
I confirmed test failure with
xgettext0.21, it passes with the version0.19.8.1.We can skip this test on specific versions ofxgettext. Do you know when exactly it stopped to warn about multiple bare placeholders? Changelog would be helpful.