TestFixture.test_get_hashes fails in Python 3.12

Bug #2046220 reported by Thomas Goirand
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
oslo.versionedobjects
In Progress
Undecided
Unassigned

Bug Description

Hi,

Building the python-oslo.versionedobjects package in Debian Sid, with Python 3.12 as available interpreter version (meaning the unit tests are run with 3.11 and 3.12), I get the below unit test failure:

======================================================================
FAIL: oslo_versionedobjects.tests.test_objects.TestFixture.test_get_hashes
oslo_versionedobjects.tests.test_objects.TestFixture.test_get_hashes
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/oslo_versionedobjects/tests/test_objects.py", line 611, in test_get_hashes
    self.assertEqual('1.6-fb5f5379168bf08f7f2ce0a745e91027',
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 394, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 481, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: !=:
reference = '1.6-fb5f5379168bf08f7f2ce0a745e91027'
actual = '1.6-33df6764eb28348018ac966b9697d855'

Given the comment of the unit test:

        # NOTE(danms): If this object's version or hash changes, this needs
        # to change. Otherwise, leave it alone.

I'm blacklisting the unit test in the package. However, it'd be nice to fix it ASAP upstream too.

Cheers,

Thomas Goirand (zigo)

Revision history for this message
James Page (james-page) wrote :

This is caused by a change in the representation of an OrderedDict @ Python 3.12:

< 3.12:

print(OrderedDict({1:2, 3:4}))
OrderedDict([(1, 2), (3, 4)])

>= 3.12:

print(OrderedDict({1:2, 3:4}))
OrderedDict({1: 2, 3: 4})

a subtle but important difference when calculating the signature of the objects.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.versionedobjects (master)
Changed in oslo.versionedobjects:
status: New → In Progress
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.