PyYAML 5.1 breaks unit tests

Bug #1827395 reported by Ben Nemec
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.serialization
Fix Released
Critical
Ben Nemec

Bug Description

PyYAML changed the default for default_flow_style in https://github.com/yaml/pyyaml/commit/507a464ce62c933bf667b2296a96ad45f0147873

Because we weren't explicitly setting this value for our version of dumps, this broke our unit tests. We should explicitly set this since it's the expected behavior anyway. Also, we were already setting it in the dump function.

Unit test failure:
oslo_serialization.tests.test_yamlutils.BehaviorTestCase.test_dumps
-------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b' File "/opt/stack/oslo.serialization/oslo_serialization/tests/test_yamlutils.py", line 63, in test_dumps'
    b' self.assertEqual(dumped, expected)'
    b' File "/opt/stack/oslo.serialization/.tox/py37/lib/python3.7/site-packages/testtools/testcase.py", line 411, in assertEqual'
    b' self.assertThat(observed, matcher, message)'
    b' File "/opt/stack/oslo.serialization/.tox/py37/lib/python3.7/site-packages/testtools/testcase.py", line 498, in assertThat'
    b' raise mismatch_error'
    b'testtools.matchers._impl.MismatchError: !=:'
    b"reference = '''\\"
    b'- foo: bar'
    b'- list: null'
    b'- - one'
    b' - two'
    b'- check: yaml'
    b' in: test'
    b"'''"
    b"actual = '''\\"
    b'- {foo: bar}'
    b'- {list: null}'
    b'- [one, two]'
    b'- {check: yaml, in: test}'
    b"'''"
    b''
    b''

Revision history for this message
Ben Nemec (bnemec) wrote :
Changed in oslo.serialization:
status: Triaged → 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.