6.2.0: oslo_i18n.tests.test_fixture.PrefixLazyTranslationTest.* regressions

Bug #2043539 reported by Michał Górny
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.i18n
Fix Released
High
Unassigned

Bug Description

In 6.2.0, I'm getting two test regressions:

```
$ tox -e py310
[...]
==============================
Failed 2 tests - output below:
==============================

oslo_i18n.tests.test_fixture.PrefixLazyTranslationTest.test_default
-------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/tmp/oslo.i18n/oslo_i18n/tests/test_fixture.py", line 98, in test_default
    self.assertEqual(expected_msg, _translate.translate(msg1))

      File "/tmp/oslo.i18n/.tox/py310/lib/python3.10/site-packages/testtools/testcase.py", line 394, in assertEqual
    self.assertThat(observed, matcher, message)

      File "/tmp/oslo.i18n/.tox/py310/lib/python3.10/site-packages/testtools/testcase.py", line 481, in assertThat
    raise mismatch_error

    testtools.matchers._impl.MismatchError: 'oslo_i18n/en_US: fake msg1' != 'oslo_i18n/pl_PL: fake msg1'

oslo_i18n.tests.test_fixture.PrefixLazyTranslationTest.test_extra_lang
----------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/tmp/oslo.i18n/oslo_i18n/tests/test_fixture.py", line 114, in test_extra_lang
    self.assertEqual(expected_msg_en_US, _translate.translate(msg1))

      File "/tmp/oslo.i18n/.tox/py310/lib/python3.10/site-packages/testtools/testcase.py", line 394, in assertEqual
    self.assertThat(observed, matcher, message)

      File "/tmp/oslo.i18n/.tox/py310/lib/python3.10/site-packages/testtools/testcase.py", line 481, in assertThat
    raise mismatch_error

    testtools.matchers._impl.MismatchError: 'oslo_i18n/en_US: fake msg1' != 'oslo_i18n/pl_PL: fake msg1'
```

FWICS this is because PrefixLazyTranslation class still mocks `locale.getdefaultlocale` rather than `locale.getlocale`.

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

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/oslo.i18n/+/901002

Changed in oslo.i18n:
status: New → In Progress
Changed in oslo.i18n:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.i18n (master)

Reviewed: https://review.opendev.org/c/openstack/oslo.i18n/+/901002
Committed: https://opendev.org/openstack/oslo.i18n/commit/151fa09cf0248b2dfc8bb9e960e0383583985781
Submitter: "Zuul (22348)"
Branch: master

commit 151fa09cf0248b2dfc8bb9e960e0383583985781
Author: Michał Górny <email address hidden>
Date: Wed Nov 15 09:16:21 2023 +0100

    Fix leftover `locale.getdefaultlocale` mock

    Replace the remaining `locale.getdefaultlocale` mock with
    `locale.getlocale`. 77a994a99385d33b1b2e626094cbd09fd0d85873 has
    replaced the `locale.getdefaultlocale()` call and updated all other
    mocks but this one remained, causing test failures on non-en_US locales.

    Closes-Bug: 2043539
    Change-Id: I5ab36a0ead05fa7a83fc1c64e440482f2cc8e675
    Signed-off-by: Michał Górny <email address hidden>

Changed in oslo.i18n:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.i18n 6.3.0

This issue was fixed in the openstack/oslo.i18n 6.3.0 release.

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.