cloud-init/cloud-init-21.4-Fix-unit-test-broken-by-pyyaml-upgrade.patch
2021-12-15 04:34:06 -05:00

35 lines
1.2 KiB
Diff

From 125dcb28ea30affeec44029d99bee4b130d5fdc8 Mon Sep 17 00:00:00 2001
From: James Falcon <james.falcon@canonical.com>
Date: Mon, 18 Oct 2021 10:20:18 -0500
Subject: [PATCH] Fix unit test broken by pyyaml upgrade (#1071)
PyYAML upgraded from 5.4.1 to 6.0.0. 6.0.0 always requires a `Loader`
arg to `yaml.load()`
---
tests/unittests/test_net_freebsd.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/unittests/test_net_freebsd.py b/tests/unittests/test_net_freebsd.py
index 466d472b84..e339e1324b 100644
--- a/tests/unittests/test_net_freebsd.py
+++ b/tests/unittests/test_net_freebsd.py
@@ -1,8 +1,8 @@
import os
-import yaml
import cloudinit.net
import cloudinit.net.network_state
+from cloudinit import safeyaml
from cloudinit.tests.helpers import (CiTestCase, mock, readResource, dir2dict)
@@ -65,7 +65,7 @@ def test_render_output_has_yaml(self, mock_subp):
entry = {
'yaml': V1,
}
- network_config = yaml.load(entry['yaml'])
+ network_config = safeyaml.load(entry['yaml'])
ns = cloudinit.net.network_state.parse_net_config_data(network_config)
files = self._render_and_read(state=ns)
assert files == {