diff options
author | Alexis Ballier <aballier@gentoo.org> | 2019-12-12 13:30:24 +0100 |
---|---|---|
committer | Alexis Ballier <aballier@gentoo.org> | 2019-12-12 13:30:58 +0100 |
commit | 4802c80a79460799ec1a1529350b36944738ed30 (patch) | |
tree | 900f224abb22d3e22a8573ec45d39506a47c9f0c /dev-ros/test_rosparam | |
parent | dev-ros/rosparam: add another upstream yaml.load patch (diff) | |
download | gentoo-4802c80a79460799ec1a1529350b36944738ed30.tar.gz gentoo-4802c80a79460799ec1a1529350b36944738ed30.tar.bz2 gentoo-4802c80a79460799ec1a1529350b36944738ed30.zip |
dev-ros/test_rosparam: fix usage of yaml.laod
Tests still fail though.
Package-Manager: Portage-2.3.81, Repoman-2.3.20
Signed-off-by: Alexis Ballier <aballier@gentoo.org>
Diffstat (limited to 'dev-ros/test_rosparam')
-rw-r--r-- | dev-ros/test_rosparam/files/yaml.patch | 75 | ||||
-rw-r--r-- | dev-ros/test_rosparam/test_rosparam-1.14.3.ebuild | 3 |
2 files changed, 77 insertions, 1 deletions
diff --git a/dev-ros/test_rosparam/files/yaml.patch b/dev-ros/test_rosparam/files/yaml.patch new file mode 100644 index 000000000000..48f2c1d5bb19 --- /dev/null +++ b/dev-ros/test_rosparam/files/yaml.patch @@ -0,0 +1,75 @@ +From 29053c4832229efa7160fb944c05e3bc82e11540 Mon Sep 17 00:00:00 2001 +From: Martijn Buijs <Martijn.buijs@gmail.com> +Date: Tue, 23 Apr 2019 18:20:12 +0200 +Subject: [PATCH] Switch to yaml.safe_load(_all) to prevent YAMLLoadWarning + (#1688) + +* Switch to yaml.safe_load(_all) to prevent YAMLLoadWarning + +* Change all usages of yaml.load to yaml.safe_load + +* Extend PyYAML's SafeLoader and use it with `yaml.load` + +Also added convenience functions for using this loader for reuse in +`roslaunch` + +* fix typo in rosparam.yaml_load_all + +* Modify Loader and SafeLoader in yaml module directly + +* Revert whitespace change + +* Revert unrelated change to import through global variable construction +--- + clients/rospy/src/rospy/client.py | 2 +- + .../test/test_roslib_message.py | 2 +- + .../client_verification/test_slave_api.py | 2 +- + test/test_rosparam/test/check_rosparam.py | 8 ++--- + .../check_rosparam_command_line_online.py | 2 +- + .../check_rosservice_command_line_online.py | 4 +-- + test/test_rostopic/test/test_rostopic_unit.py | 30 +++++++++---------- + tools/rosbag/src/rosbag/bag.py | 2 +- + tools/rosgraph/src/rosgraph/roslogging.py | 2 +- + tools/roslaunch/src/roslaunch/loader.py | 4 +-- + .../test/unit/test_roslaunch_dump_params.py | 4 +-- + tools/rosparam/src/rosparam/__init__.py | 7 ++++- + tools/rosservice/src/rosservice/__init__.py | 4 +-- + tools/rostopic/src/rostopic/__init__.py | 6 ++-- + tools/topic_tools/scripts/relay_field | 2 +- + 15 files changed, 43 insertions(+), 38 deletions(-) + +diff --git a/test/test_rosparam/test/check_rosparam.py b/test/test_rosparam/test/check_rosparam.py +index 52ed976b5..fe8c03fb4 100755 +--- a/test/test_rosparam/test/check_rosparam.py ++++ b/test/test_rosparam/test/check_rosparam.py +@@ -227,7 +227,7 @@ def test_rosparam_get(self): + with fakestdout() as b: + rosparam.yamlmain([cmd, 'get', "g1"]) + import yaml +- d = yaml.load(b.getvalue()) ++ d = yaml.safe_load(b.getvalue()) + self.assertEquals(d['float'], 10.0) + self.assertEquals(d['int'], 10.0) + self.assertEquals(d['string'], "g1-foo-value") +@@ -346,18 +346,18 @@ def test_rosparam_dump(self): + import yaml + with open(f_out) as b: + with open(f) as b2: +- self.assertEquals(yaml.load(b.read()), yaml.load(b2.read())) ++ self.assertEquals(yaml.safe_load(b.read()), yaml.safe_load(b2.read())) + + rosparam.yamlmain([cmd, 'dump', '-v', f_out, 'rosparam_dump']) + with open(f_out) as b: + with open(f) as b2: +- self.assertEquals(yaml.load(b.read()), yaml.load(b2.read())) ++ self.assertEquals(yaml.safe_load(b.read()), yaml.safe_load(b2.read())) + + # yaml file and std_out should be the same + with fakestdout() as b: + rosparam.yamlmain([cmd, 'dump']) + with open(f) as b2: +- self.assertEquals(yaml.load(b.getvalue())['rosparam_dump'], yaml.load(b2.read())) ++ self.assertEquals(yaml.safe_load(b.getvalue())['rosparam_dump'], yaml.safe_load(b2.read())) + + def test_fullusage(self): + import rosparam diff --git a/dev-ros/test_rosparam/test_rosparam-1.14.3.ebuild b/dev-ros/test_rosparam/test_rosparam-1.14.3.ebuild index 1c24d77d5702..9deec865fa13 100644 --- a/dev-ros/test_rosparam/test_rosparam-1.14.3.ebuild +++ b/dev-ros/test_rosparam/test_rosparam-1.14.3.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2018 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=5 @@ -24,3 +24,4 @@ DEPEND="${RDEPEND} dev-python/nose[${PYTHON_USEDEP}] dev-ros/rosparam[${PYTHON_USEDEP}] )" +PATCHES=( "${FILESDIR}/yaml.patch" ) |