From e0ed17a8a2d29acb0f62c4629f911b5825216cba Mon Sep 17 00:00:00 2001 From: debugtalk Date: Wed, 4 Dec 2019 17:46:35 +0800 Subject: [PATCH] fix compatibility for Python version prior to 3.6 --- httprunner/context.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/httprunner/context.py b/httprunner/context.py index 27b3406c..b562cad7 100644 --- a/httprunner/context.py +++ b/httprunner/context.py @@ -194,11 +194,11 @@ class SessionContext(object): } script = "\n ".join(script) - code = f""" + code = """ # encoding: utf-8 try: - {script} + {} except Exception as ex: import traceback import sys @@ -218,7 +218,7 @@ except Exception as ex: c_exception += "\\tError description: " + _type.__name__ raise _type(c_exception) -""" +""".format(script) variables = { "status_code": resp_obj.status_code, "response_json": resp_obj.json,