merge with master

This commit is contained in:
debugtalk
2018-08-02 14:09:15 +08:00
15 changed files with 167 additions and 703 deletions

View File

@@ -4,9 +4,9 @@ import json
import re
from httprunner import exceptions, logger, testcase, utils
from httprunner.compat import OrderedDict, basestring
from requests.structures import CaseInsensitiveDict
from httprunner.compat import OrderedDict, basestring, is_py2
from requests.models import PreparedRequest
from requests.structures import CaseInsensitiveDict
text_extractor_regexp_compile = re.compile(r".*\(.*\).*")
@@ -197,6 +197,9 @@ class ResponseObject(object):
else:
value = self._extract_field_with_delimiter(field)
if is_py2 and isinstance(value, unicode):
value = value.encode("utf-8")
msg += "\t=> {}".format(value)
logger.log_debug(msg)

View File

@@ -14,16 +14,17 @@ class Runner(object):
self.context = Context()
config_dict = config_dict or {}
self.init_config(config_dict, "testset")
# testset setup hooks
testset_setup_hooks = config_dict.pop("setup_hooks", [])
if testset_setup_hooks:
self.do_hook_actions(testset_setup_hooks)
# testset teardown hooks
self.testset_teardown_hooks = config_dict.pop("teardown_hooks", [])
self.init_config(config_dict, "testset")
if testset_setup_hooks:
self.do_hook_actions(testset_setup_hooks)
def __del__(self):
if self.testset_teardown_hooks:
self.do_hook_actions(self.testset_teardown_hooks)