[Asterisk-code-review] Remove YAMLLoadWarning: calling yaml.load() (...testsuite[certified/13.21])

Kevin Harwell asteriskteam at digium.com
Fri May 3 09:39:19 CDT 2019


Kevin Harwell has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/testsuite/+/11343 )

Change subject: Remove YAMLLoadWarning: calling yaml.load()
......................................................................

Remove YAMLLoadWarning: calling yaml.load()

>From PyYAML 5.1 yaml.load(x) the use as plain is deprecated

This change use a SafeLoader as Loader for the yaml.load called function

Info: https://msg.pyyaml.org/load
Change-Id: I2d4ef93ad0c8503040e4a673d819f5a0c075f0f6
(cherry picked from commit a065e30164b8a424bfccf0fd2eea64a8ed677c50)
---
M lib/python/asterisk/test_config.py
M runtests.py
2 files changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, approved; Approved for Submit



diff --git a/lib/python/asterisk/test_config.py b/lib/python/asterisk/test_config.py
index 8fdb884..0c03e2f 100644
--- a/lib/python/asterisk/test_config.py
+++ b/lib/python/asterisk/test_config.py
@@ -378,7 +378,7 @@
 
         test_config = "%s/test-config.yaml" % self.test_name
         with open(test_config, "r") as config_file:
-            self.config = yaml.load(config_file)
+            self.config = yaml.load(config_file, Loader=yaml.SafeLoader)
 
         if not self.config:
             print "ERROR: Failed to load configuration for test '%s'" % \
diff --git a/runtests.py b/runtests.py
index be1055f..d770e04 100755
--- a/runtests.py
+++ b/runtests.py
@@ -761,7 +761,7 @@
         print "Unexpected error: %s" % sys.exc_info()[0]
         return None
 
-    config = yaml.load(f)
+    config = yaml.load(f, Loader=yaml.SafeLoader)
     f.close()
 
     return config

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/11343
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: certified/13.21
Gerrit-Change-Id: I2d4ef93ad0c8503040e4a673d819f5a0c075f0f6
Gerrit-Change-Number: 11343
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Rodrigo Ramirez Norambuena <a at rodrigoramirez.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190503/84bdff7e/attachment.html>


More information about the asterisk-code-review mailing list