bugfix: Python2 does not support encoding parameter in open function; use codecs.open instead.

This commit is contained in:
debugtalk
2017-08-17 21:56:43 +08:00
parent c716be0df6
commit a871bcf837

View File

@@ -1,3 +1,4 @@
import codecs
import hashlib
import hmac
import json
@@ -5,8 +6,8 @@ import os.path
import random
import re
import string
import yaml
from ate import exception
try:
@@ -32,11 +33,11 @@ def get_sign(*args):
return sign
def load_yaml_file(yaml_file):
with open(yaml_file, 'r+', encoding='utf-8') as stream:
with codecs.open(yaml_file, 'r+', encoding='utf-8') as stream:
return yaml.load(stream)
def load_json_file(json_file):
with open(json_file, encoding='utf-8') as data_file:
with codecs.open(json_file, encoding='utf-8') as data_file:
return json.load(data_file)
def load_testcases(testcase_file_path):