python: Fix yaml.load warnings

Since pyyaml 5.1 yaml.load without specifing loader is deprecated
Details: https://msg.pyyaml.org/load

To keep code compatible with older versions of pyyaml
and keep best perfomance CLoader with fallback to Loader is used.
This commit is contained in:
Sergei Silnov
2019-06-28 16:36:20 +02:00
committed by bot
parent c27fd32fbe
commit c57dfbc0b8
7 changed files with 45 additions and 9 deletions

View File

@@ -9,6 +9,11 @@ import argparse
import yaml
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader as Loader
try:
from Utility import CIAssignTest
except ImportError:
@@ -110,7 +115,7 @@ class UnitTestAssignTest(CIAssignTest.AssignTest):
try:
with open(test_case_path, "r") as f:
raw_data = yaml.load(f)
raw_data = yaml.load(f, Loader=Loader)
test_cases = raw_data["test cases"]
except IOError:
print("Test case path is invalid. Should only happen when use @bot to skip unit test.")