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
New
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

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.