Dropping babel broke Glance unit tests

Bug #1877386 reported by Ben Nemec
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.i18n
Fix Released
High
Unassigned

Bug Description

Glance has a periodic job that runs against Oslo master, and it has been broken since we merged the change to remove Babel. Based on their investigation, it looks like the "it" translation is no longer available.

I see the stdlib locale lists provides an Italian translation named it_IT, but this does raise the issue that people using the "it" locale before will be broken after this change. We need to determine what to do about that.

Revision history for this message
Abhishek Kekane (abhishek-kekane) wrote :
Revision history for this message
Ben Nemec (bnemec) wrote :

Copying the traceback here so we don't lose it when the logs get garbage collected:

ft1.12: glance.tests.unit.common.test_wsgi.RequestTest.test_best_match_language_expectedtesttools.testresult.real._StringException: Traceback (most recent call last):
  File "/home/zuul/src/opendev.org/openstack/glance/glance/tests/unit/common/test_wsgi.py", line 178, in test_best_match_language_expected
    self.assertEqual('it', req.best_match_language())
  File "/home/zuul/src/opendev.org/openstack/glance/.tox/py36/lib/python3.6/site-packages/testtools/testcase.py", line 415, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/home/zuul/src/opendev.org/openstack/glance/.tox/py36/lib/python3.6/site-packages/testtools/testcase.py", line 502, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: 'it' != None

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.i18n (master)

Reviewed: https://review.opendev.org/730417
Committed: https://git.openstack.org/cgit/openstack/oslo.i18n/commit/?id=09012839233f0e6b57cd590251797b71b3127f26
Submitter: Zuul
Branch: master

commit 09012839233f0e6b57cd590251797b71b3127f26
Author: Ben Nemec <email address hidden>
Date: Fri May 22 21:01:11 2020 +0000

    Add Babel aliases to get_available_languages

    This pulls in the alias mapping from Babel[0] that previously made
    some two character locale names available. It simply appends each
    alias that is found by gettext.find to the list of available languages.

    This change in behavior was initially reported as a result of a
    breaking Glance unit test. After looking a bit closer at the test
    in question, it appears they mock out gettext.find to assume the
    existence of that locale. Whether it would actually exist in a real
    world deployment I have no idea. However, I don't think it hurts
    anything to include these aliases in the list checked by
    get_available_languages so this should be fine.

    Note that I did no mapping of the aliases in our override of
    gettext.find. There was no aliasing going on there for these two
    letter locales before either, so if they were found before they
    will be found now. The same is true if they were not found before,
    so this maintains the previous behavior.

    Change-Id: Ie57ed2ca0228634ed9a3def99bf606ce1832a195
    0: https://github.com/python-babel/babel/blob/e7e4265d9a037ac38bba99f8513fb9e48a1081ba/babel/core.py#L80
    Closes-Bug: 1877386

Changed in oslo.i18n:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.