diff options
author | Zuul <zuul@review.opendev.org> | 2019-12-16 15:00:56 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2019-12-16 15:00:56 +0000 |
commit | 63d877945d1474296ab6ba45ad3e6dcd753081f1 (patch) | |
tree | cb0c2c61eba8fc9ef8df717c23d277431691e243 | |
parent | 2ea9841a9696d7e8c7cc9281dfd8de4498926090 (diff) | |
parent | 0b4ed38ca6c50f61636fd98bedf759f2198ac5e4 (diff) | |
download | python-jenkins-job-builder-63d877945d1474296ab6ba45ad3e6dcd753081f1.tar.gz python-jenkins-job-builder-63d877945d1474296ab6ba45ad3e6dcd753081f1.tar.xz python-jenkins-job-builder-63d877945d1474296ab6ba45ad3e6dcd753081f1.zip |
Merge "Fix the yaml load warning."3.2.0
-rw-r--r-- | jenkins_jobs/cache.py | 2 | ||||
-rw-r--r-- | jenkins_jobs/cli/entry.py | 2 | ||||
-rw-r--r-- | tests/cachestorage/test_cachestorage.py | 2 | ||||
-rw-r--r-- | tests/cmd/subcommands/test_test.py | 2 | ||||
-rw-r--r-- | tests/modules/test_helpers.py | 12 |
5 files changed, 10 insertions, 10 deletions
diff --git a/jenkins_jobs/cache.py b/jenkins_jobs/cache.py index 01769295..62621b56 100644 --- a/jenkins_jobs/cache.py +++ b/jenkins_jobs/cache.py @@ -59,7 +59,7 @@ class JobCache(object): self.data = {} else: with io.open(self.cachefilename, "r", encoding="utf-8") as yfile: - self.data = yaml.load(yfile) + self.data = yaml.safe_load(yfile) logger.debug("Using cache: '{0}'".format(self.cachefilename)) def _lock(self): diff --git a/jenkins_jobs/cli/entry.py b/jenkins_jobs/cli/entry.py index e67ecb24..3aa24fe1 100644 --- a/jenkins_jobs/cli/entry.py +++ b/jenkins_jobs/cli/entry.py @@ -101,7 +101,7 @@ class JenkinsJobs(object): with io.open( self.options.plugins_info_path, "r", encoding="utf-8" ) as yaml_file: - plugins_info = yaml.load(yaml_file) + plugins_info = yaml.safe_load(yaml_file) if not isinstance(plugins_info, list): self.parser.error( "{0} must contain a Yaml list!".format( diff --git a/tests/cachestorage/test_cachestorage.py b/tests/cachestorage/test_cachestorage.py index 34803895..13c7b87a 100644 --- a/tests/cachestorage/test_cachestorage.py +++ b/tests/cachestorage/test_cachestorage.py @@ -40,6 +40,6 @@ class TestCaseJobCache(base.BaseTestCase): """ test_file = os.path.abspath(__file__) with mock.patch("os.path.join", return_value=test_file): - with mock.patch("yaml.load"): + with mock.patch("yaml.safe_load"): with mock.patch("jenkins_jobs.builder.JobCache._lock"): jenkins_jobs.builder.JobCache("dummy").data = None diff --git a/tests/cmd/subcommands/test_test.py b/tests/cmd/subcommands/test_test.py index 1e0234a9..ee7d93a7 100644 --- a/tests/cmd/subcommands/test_test.py +++ b/tests/cmd/subcommands/test_test.py @@ -213,7 +213,7 @@ class TestTests(CmdTestsBase): self.execute_jenkins_jobs_with_args(args) with io.open(plugins_info_stub_yaml_file, "r", encoding="utf-8") as yaml_file: - plugins_info_list = yaml.load(yaml_file) + plugins_info_list = yaml.safe_load(yaml_file) registry_mock.assert_called_with(mock.ANY, plugins_info_list) diff --git a/tests/modules/test_helpers.py b/tests/modules/test_helpers.py index f0cebb41..6fc50496 100644 --- a/tests/modules/test_helpers.py +++ b/tests/modules/test_helpers.py @@ -31,7 +31,7 @@ class TestCaseTestHelpers(base.BaseTestCase): # Test default values default_root = XML.Element("testdefault") - default_data = yaml.load("string: hello") + default_data = yaml.safe_load("string: hello") default_mappings = [("default-string", "defaultString", "default")] convert_mapping_to_xml( @@ -42,7 +42,7 @@ class TestCaseTestHelpers(base.BaseTestCase): # Test user input user_input_root = XML.Element("testUserInput") - user_input_data = yaml.load("user-input-string: hello") + user_input_data = yaml.safe_load("user-input-string: hello") user_input_mappings = [("user-input-string", "userInputString", "user-input")] convert_mapping_to_xml( @@ -53,7 +53,7 @@ class TestCaseTestHelpers(base.BaseTestCase): # Test missing required input required_root = XML.Element("testrequired") - required_data = yaml.load("string: hello") + required_data = yaml.safe_load("string: hello") required_mappings = [("required-string", "requiredString", None)] self.assertRaises( @@ -67,7 +67,7 @@ class TestCaseTestHelpers(base.BaseTestCase): # Test invalid user input for list user_input_root = XML.Element("testUserInput") - user_input_data = yaml.load("user-input-string: bye") + user_input_data = yaml.safe_load("user-input-string: bye") valid_inputs = ["hello"] user_input_mappings = [ ("user-input-string", "userInputString", "user-input", valid_inputs) @@ -83,7 +83,7 @@ class TestCaseTestHelpers(base.BaseTestCase): # Test invalid user input for dict user_input_root = XML.Element("testUserInput") - user_input_data = yaml.load("user-input-string: later") + user_input_data = yaml.safe_load("user-input-string: later") valid_inputs = {"hello": "world"} user_input_mappings = [ ("user-input-string", "userInputString", "user-input", valid_inputs) @@ -99,7 +99,7 @@ class TestCaseTestHelpers(base.BaseTestCase): # Test invalid key for dict user_input_root = XML.Element("testUserInput") - user_input_data = yaml.load("user-input-string: world") + user_input_data = yaml.safe_load("user-input-string: world") valid_inputs = {"hello": "world"} user_input_mappings = [ ("user-input-string", "userInputString", "user-input", valid_inputs) |