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

Friendly Automation asteriskteam at digium.com
Fri Apr 26 18:05:15 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/testsuite/+/11309 )

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
---
M lib/python/asterisk/test_config.py
M runtests.py
2 files changed, 2 insertions(+), 2 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/lib/python/asterisk/test_config.py b/lib/python/asterisk/test_config.py
index 6d2318d..4860cb3 100644
--- a/lib/python/asterisk/test_config.py
+++ b/lib/python/asterisk/test_config.py
@@ -374,7 +374,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 d1bc4aa..fe04213 100755
--- a/runtests.py
+++ b/runtests.py
@@ -772,7 +772,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/+/11309
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 13
Gerrit-Change-Id: I2d4ef93ad0c8503040e4a673d819f5a0c075f0f6
Gerrit-Change-Number: 11309
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: 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/20190426/56712ef8/attachment-0001.html>


More information about the asterisk-code-review mailing list