Version 5.1 dumps strings differently on different platforms
See original GitHub issueAfter 5.1 has been released, our CI builds started to fail. The reason is different outputs on Linux, Mac and Windows, depending on Python version. The problem displays as different way to dump string containing tabs, on different platforms. I’d accept any of dump variants from 5.1 if it would be consistent across platforms. But having it different creates a mess with automated tests.
I have made simple unit test to reproduce the problem (https://github.com/Blazemeter/taurus/pull/1076). The code to reproduce is:
class MyTestCase(unittest.TestCase):
def test_case(self):
data = {"str": "\tpart1\tpart2\t"}
res = yaml.safe_dump(data,
default_flow_style=False, explicit_start=True, canonical=False,
allow_unicode=True, encoding='utf-8', width=float("inf"))
res = res.decode('utf8')
self.assertEqual('---\nstr: "\\tpart1\\tpart2\\t\"\n', res)
This test works fine on Linux with any Python version, Windows with Python 3. It fails on MacOS with Python 2.7 and on Windows with Python 2.7.
I double-checked that version of PyYAML is 5.1 on all builds.
Relevant CI links: Linux and Mac: https://travis-ci.org/Blazemeter/taurus/builds/507459846 Windows: https://ci.appveyor.com/project/undera/taurus/builds/23134929
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (8 by maintainers)
Top GitHub Comments
Closing. Please reopen if necessary. Thanks!
We released 5.2: https://pypi.org/project/PyYAML/5.2/