mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 22:44:05 +08:00
bugfix: Python2 does not support encoding parameter in open function; use codecs.open instead.
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import codecs
|
||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import json
|
import json
|
||||||
@@ -5,8 +6,8 @@ import os.path
|
|||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from ate import exception
|
from ate import exception
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -32,11 +33,11 @@ def get_sign(*args):
|
|||||||
return sign
|
return sign
|
||||||
|
|
||||||
def load_yaml_file(yaml_file):
|
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)
|
return yaml.load(stream)
|
||||||
|
|
||||||
def load_json_file(json_file):
|
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)
|
return json.load(data_file)
|
||||||
|
|
||||||
def load_testcases(testcase_file_path):
|
def load_testcases(testcase_file_path):
|
||||||
|
|||||||
Reference in New Issue
Block a user