[Django] #31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails with gettext-0.21

71 views
Skip to first unread message

Django

unread,
Aug 3, 2020, 9:27:57 AM8/3/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails
with gettext-0.21
-----------------------------------------+------------------------
Reporter: mgorny | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
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).

--
Ticket URL: <https://code.djangoproject.com/ticket/31850>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 3, 2020, 3:30:26 PM8/3/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails
with xgettext 0.21.
--------------------------------------+------------------------------------
Reporter: Michał Górny | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by felixxm):

* type: Bug => Cleanup/optimization
* component: Uncategorized => Testing framework
* easy: 0 => 1
* stage: Unreviewed => Accepted


Comment:

I confirmed test failure with `xgettext` 0.21, it passes with the version
`0.19.8.1`. We can skip this test on specific versions of `xgettext`. Do
you know when exactly it stopped to warn about multiple bare placeholders?
Changelog would be helpful.

--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:1>

Django

unread,
Aug 4, 2020, 12:13:30 AM8/4/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails

with xgettext 0.21.
--------------------------------------+------------------------------------
Reporter: Michał Górny | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by felixxm):

We should use a message that will cause a `xgettext` warning in all
versions, see #18479.

--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:2>

Django

unread,
Aug 20, 2020, 5:45:26 PM8/20/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails
with xgettext 0.21.
--------------------------------------+------------------------------------
Reporter: Michał Górny | Owner: Sicong
Type: Cleanup/optimization | Status: assigned

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Sicong):

* owner: nobody => Sicong
* status: new => assigned


Comment:

I'll try to work on this issue.

--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:3>

Django

unread,
Aug 31, 2020, 5:31:53 PM8/31/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails
with xgettext 0.21.
--------------------------------------+------------------------------------
Reporter: Michał Górny | Owner: (none)
Type: Cleanup/optimization | Status: new

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Sicong):

* owner: Sicong => (none)
* status: assigned => new


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:4>

Django

unread,
Aug 31, 2020, 11:45:07 PM8/31/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails
with xgettext 0.21.
-------------------------------------+-------------------------------------
Reporter: Michał Górny | Owner:
Type: | stackaccount1
Cleanup/optimization | Status: assigned

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by stackaccount1):

* owner: (none) => stackaccount1


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:5>

Django

unread,
Sep 30, 2020, 4:00:43 PM9/30/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails
with xgettext 0.21.
--------------------------------------+------------------------------------
Reporter: Michał Górny | Owner: Ira
Type: Cleanup/optimization | Status: assigned

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Ira):

Can someone above help me reproduce the error? Please let me know
ira...@gmail.com

--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:6>

Django

unread,
Oct 6, 2020, 5:28:09 PM10/6/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails
with xgettext 0.21.
-------------------------------------+-------------------------------------
Reporter: Michał Górny | Owner: Max
Type: | Smolens

Cleanup/optimization | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Max Smolens):

* owner: (none) => Max Smolens


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:8>

Django

unread,
Oct 6, 2020, 6:12:33 PM10/6/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails

with xgettext 0.21.
-------------------------------------+-------------------------------------
Reporter: Michał Górny | Owner: Max
Type: | Smolens
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Max Smolens):

* has_patch: 0 => 1


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:9>

Django

unread,
Nov 2, 2020, 4:24:04 AM11/2/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails

with xgettext 0.21.
-------------------------------------+-------------------------------------
Reporter: Michał Górny | Owner: Max
Type: | Smolens
Cleanup/optimization | Status: closed

Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Michał Górny):

Would it be possible to backport this into 2.2, 3.0 and 3.1 branches?

--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:13>

Django

unread,
Nov 2, 2020, 4:29:53 AM11/2/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails

with xgettext 0.21.
-------------------------------------+-------------------------------------
Reporter: Michał Górny | Owner: Max
Type: | Smolens
Cleanup/optimization | Status: closed
Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"e707a1bd9a485319421414f2d171c3faca9cd58c" e707a1bd]:
{{{
#!CommitTicketReference repository=""
revision="e707a1bd9a485319421414f2d171c3faca9cd58c"
[3.1.x] Fixed #31850 -- Fixed BasicExtractorTests.test_extraction_warning
with xgettext 0.21+.

"format string with unnamed arguments cannot be properly localized"

warning is not raised in xgettext 0.21+.

This patch uses a message that causes an xgettext warning regardless of
the version.

Backport of 07a30f561661efae1691ff45d10ec6014b395b58 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:14>

Django

unread,
Nov 2, 2020, 4:30:30 AM11/2/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails

with xgettext 0.21.
-------------------------------------+-------------------------------------
Reporter: Michał Górny | Owner: Max
Type: | Smolens
Cleanup/optimization | Status: closed
Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"c506639b425ca876b2d9a633fc6410e917d45605" c506639b]:
{{{
#!CommitTicketReference repository=""
revision="c506639b425ca876b2d9a633fc6410e917d45605"
[3.0.x] Fixed #31850 -- Fixed BasicExtractorTests.test_extraction_warning
with xgettext 0.21+.

"format string with unnamed arguments cannot be properly localized"
warning is not raised in xgettext 0.21+.

This patch uses a message that causes an xgettext warning regardless of
the version.

Backport of 07a30f561661efae1691ff45d10ec6014b395b58 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:15>

Django

unread,
Nov 2, 2020, 4:31:18 AM11/2/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails

with xgettext 0.21.
-------------------------------------+-------------------------------------
Reporter: Michał Górny | Owner: Max
Type: | Smolens
Cleanup/optimization | Status: closed
Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"e893c0ad8b0b5b0a1e5be3345c287044868effc4" e893c0ad]:
{{{
#!CommitTicketReference repository=""
revision="e893c0ad8b0b5b0a1e5be3345c287044868effc4"
[2.2.x] Fixed #31850 -- Fixed BasicExtractorTests.test_extraction_warning
with xgettext 0.21+.

"format string with unnamed arguments cannot be properly localized"
warning is not raised in xgettext 0.21+.

This patch uses a message that causes an xgettext warning regardless of
the version.

Backport of 07a30f561661efae1691ff45d10ec6014b395b58 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:16>

Django

unread,
Nov 2, 2020, 4:32:21 AM11/2/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails

with xgettext 0.21.
-------------------------------------+-------------------------------------
Reporter: Michał Górny | Owner: Max
Type: | Smolens
Cleanup/optimization | Status: closed
Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak):

Replying to [comment:13 Michał Górny]:


> Would it be possible to backport this into 2.2, 3.0 and 3.1 branches?

Backported.

--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:17>

Django

unread,
Nov 2, 2020, 4:38:27 AM11/2/20
to django-...@googlegroups.com
#31850: test_extraction_warning (i18n.test_extraction.BasicExtractorTests) fails

with xgettext 0.21.
-------------------------------------+-------------------------------------
Reporter: Michał Górny | Owner: Max
Type: | Smolens
Cleanup/optimization | Status: closed
Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Michał Górny):

That was fast. Thank you!

--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:18>

Reply all
Reply to author
Forward
0 new messages