py3.11: unit test failure

Bug #2000437 reported by Thomas Goirand
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
oslo.i18n
Fix Released
Undecided
Unassigned

Bug Description

Hi,

Under Python 3.11, we have the below unit test failure (this is oslo.i18n 5.1.0 in Debian Unstable).

FAIL: oslo_i18n.tests.test_message.MessageTestCase.test_translate_message_bad_translation
oslo_i18n.tests.test_message.MessageTestCase.test_translate_message_bad_translation
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/usr/lib/python3.11/unittest/mock.py", line 1369, in patched
    return func(*newargs, **newkeywargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/oslo_i18n/tests/test_message.py", line 389, in test_translate_message_bad_translation
    self.assertEqual(1, len(w))
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 393, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 480, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: 1 != 2

Revision history for this message
Jelle van der Waa (jelle-vdwaa) wrote :

Same issue here, the extra deprecationwarning is because of a 3.11 deprecation.

{message : DeprecationWarning('Use setlocale(), getencoding() and getlocale() instead'), category : 'DeprecationWarning', filename : '/tmp/python-oslo-i18n/trunk/src/oslo.i18n/oslo_i18n/_messa
ge.py', lineno : 101, line : None}
{message : UserWarning("Failed to insert replacement values into translated message A message in Spanish: %s %s (Original: 'A message: %s'): not enough arguments for format string"), category
: 'UserWarning', filename : '/tmp/python-oslo-i18n/trunk/src/oslo.i18n/oslo_i18n/_message.py', lineno : 173, line : None}

Revision history for this message
Jelle van der Waa (jelle-vdwaa) wrote :

Patch I'd propose http://sprunge.us/LPwTnb

Revision history for this message
Takashi Kajinami (kajinamit) wrote :

This was fixed by https://review.opendev.org/c/openstack/oslo.i18n/+/873842 which replaced the deprecated API, though I agree the proposed change makes sense.

Please feel free to submit the change to gerrit (https://docs.openstack.org/contributors/code-and-documentation/index.html) or let me know if you want me to do it.

Changed in oslo.i18n:
status: New → 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.