diff --git a/httprunner/__init__.py b/httprunner/__init__.py index db07b46c..dd499f47 100644 --- a/httprunner/__init__.py +++ b/httprunner/__init__.py @@ -1 +1 @@ -__version__ = '0.8.5' \ No newline at end of file +__version__ = '0.8.6' \ No newline at end of file diff --git a/httprunner/locusts.py b/httprunner/locusts.py index 11ade7a2..5611efb2 100644 --- a/httprunner/locusts.py +++ b/httprunner/locusts.py @@ -1,4 +1,4 @@ -import codecs +import io import multiprocessing import os import sys @@ -39,8 +39,8 @@ def gen_locustfile(testcase_file_path): testset = load_test_file(testcase_file_path) host = testset.get("config", {}).get("request", {}).get("base_url", "") - with codecs.open(template_path, encoding='utf-8') as template: - with codecs.open(locustfile_path, 'w', encoding='utf-8') as locustfile: + with io.open(template_path, encoding='utf-8') as template: + with io.open(locustfile_path, 'w', encoding='utf-8') as locustfile: template_content = template.read() template_content = template_content.replace("$HOST", host) template_content = template_content.replace("$TESTCASE_FILE", testcase_file_path) diff --git a/httprunner/testcase.py b/httprunner/testcase.py index 9652d412..c83204ac 100644 --- a/httprunner/testcase.py +++ b/httprunner/testcase.py @@ -1,5 +1,5 @@ import ast -import codecs +import io import json import logging import os @@ -22,7 +22,7 @@ testcases_cache_mapping = {} def _load_yaml_file(yaml_file): """ load yaml file and check file content format """ - with codecs.open(yaml_file, 'r', encoding='utf-8') as stream: + with io.open(yaml_file, 'r', encoding='utf-8') as stream: yaml_content = yaml.load(stream) check_format(yaml_file, yaml_content) return yaml_content @@ -30,7 +30,7 @@ def _load_yaml_file(yaml_file): def _load_json_file(json_file): """ load json file and check file content format """ - with codecs.open(json_file, encoding='utf-8') as data_file: + with io.open(json_file, encoding='utf-8') as data_file: try: json_content = json.load(data_file) except exception.JSONDecodeError: