mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 19:47:14 +08:00
fix compatibility for Python version prior to 3.6
This commit is contained in:
@@ -194,11 +194,11 @@ class SessionContext(object):
|
|||||||
}
|
}
|
||||||
|
|
||||||
script = "\n ".join(script)
|
script = "\n ".join(script)
|
||||||
code = f"""
|
code = """
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
try:
|
try:
|
||||||
{script}
|
{}
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
import traceback
|
import traceback
|
||||||
import sys
|
import sys
|
||||||
@@ -218,7 +218,7 @@ except Exception as ex:
|
|||||||
c_exception += "\\tError description: " + _type.__name__
|
c_exception += "\\tError description: " + _type.__name__
|
||||||
|
|
||||||
raise _type(c_exception)
|
raise _type(c_exception)
|
||||||
"""
|
""".format(script)
|
||||||
variables = {
|
variables = {
|
||||||
"status_code": resp_obj.status_code,
|
"status_code": resp_obj.status_code,
|
||||||
"response_json": resp_obj.json,
|
"response_json": resp_obj.json,
|
||||||
|
|||||||
Reference in New Issue
Block a user