Py3.7 two tests failing with _impl.MismatchError

Bug #1783638 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.serialization
Fix Released
Undecided
Corey Bryant

Bug Description

The following tests are failing for Py3.7:

======================================================================
FAIL: oslo_serialization.tests.test_jsonutils.JSONUtilsTestJson.test_dumps_exception_value
oslo_serialization.tests.test_jsonutils.JSONUtilsTestJson.test_dumps_exception_value
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/oslo_serialization/tests/test_jsonutils.py", line 120, in test_dumps_exception_value
    jsonutils.dumps({"a": ValueError("hello")}))
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 411, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 498, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: '{"a": "ValueError(\'hello\',)"}' != '{"a": "ValueError(\'hello\')"}'

======================================================================
FAIL: oslo_serialization.tests.test_jsonutils.ToPrimitiveTestCase.test_exception
oslo_serialization.tests.test_jsonutils.ToPrimitiveTestCase.test_exception
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/oslo_serialization/tests/test_jsonutils.py", line 411, in test_exception
    jsonutils.to_primitive(ValueError("an exception")))
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 411, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 498, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: "ValueError('an exception',)" != "ValueError('an exception')"

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

Fix proposed to branch: master
Review: https://review.openstack.org/585886

Changed in oslo.serialization:
assignee: nobody → Corey Bryant (corey.bryant)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.serialization (master)

Reviewed: https://review.openstack.org/585886
Committed: https://git.openstack.org/cgit/openstack/oslo.serialization/commit/?id=254e0ae839ecc692192f29e3aa590e6d5d3377a7
Submitter: Zuul
Branch: master

commit 254e0ae839ecc692192f29e3aa590e6d5d3377a7
Author: Corey Bryant <email address hidden>
Date: Wed Jul 25 16:52:22 2018 -0400

    py37: deal with Exception repr changes

    Under Python 3.7, a trailing comma is no longer added to
    the init parameters generated by a repr() call:

        >>> repr(Exception('It Works'))
        "Exception('It Works')"

    vs

        >>> repr(Exception('It Works'))
        "Exception('It Works',)"

    Support pre and post Python 3.7 formats in test cases.

    Change-Id: I45bdf565e170793d0342a907628638369d4d0f2f
    Closes-Bug: #1783638

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

This issue was fixed in the openstack/oslo.serialization 2.28.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.