From 85eac1bcb096eefc4f81ad045ff225dafb886a88 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Thu, 20 Jun 2019 17:14:02 +0200 Subject: [PATCH] Fix unittests for use with PyYAML 5.1 According to the ChangeLog (https://pyyaml.org/wiki/PyYAML), PyYAML 5.1 changed the default for the `default_flow_style` argument of dumpers, which makes all related unittests fail. --- src/wstool/config_yaml.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/wstool/config_yaml.py b/src/wstool/config_yaml.py index 19f82e5..294f596 100644 --- a/src/wstool/config_yaml.py +++ b/src/wstool/config_yaml.py @@ -442,11 +442,8 @@ def generate_config_yaml(config, filename, header, pretty=False, items = [x.get_legacy_yaml(spec, exact) for x in items] if items: - if pretty: - content += yaml.safe_dump(items, allow_unicode=True, - default_flow_style=False) - else: - content += yaml.safe_dump(items) + content += yaml.safe_dump(items, allow_unicode=True, + default_flow_style=False if pretty else None) if filename: config_filepath = filename if os.path.isabs(filename) else \