From 787bf012864136f002f4c65c6e9822cafc3cdaae Mon Sep 17 00:00:00 2001 From: debugtalk Date: Mon, 2 Apr 2018 16:28:46 +0800 Subject: [PATCH] bugfix: when variable reference in testcase name is extracted from former testcase, exception will occur --- httprunner/__about__.py | 2 +- httprunner/task.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/httprunner/__about__.py b/httprunner/__about__.py index b1564c26..47476962 100644 --- a/httprunner/__about__.py +++ b/httprunner/__about__.py @@ -1,7 +1,7 @@ __title__ = 'HttpRunner' __description__ = 'One-stop solution for HTTP(S) testing.' __url__ = 'https://github.com/HttpRunner/HttpRunner' -__version__ = '1.3.7' +__version__ = '1.3.8.beta' __author__ = 'debugtalk' __author_email__ = 'mail@debugtalk.com' __license__ = 'MIT' diff --git a/httprunner/task.py b/httprunner/task.py index f559fa74..467e3e00 100644 --- a/httprunner/task.py +++ b/httprunner/task.py @@ -97,7 +97,11 @@ class TestSuite(unittest.TestSuite): testcase_variables ) self.testcase_parser.update_binded_variables(variables) - testcase_name = self.testcase_parser.eval_content_with_bindings(testcase_dict["name"]) + try: + testcase_name = self.testcase_parser.eval_content_with_bindings(testcase_dict["name"]) + except (AssertionError, exception.ParamsError): + logger.log_warning("failed to eval testcase name: {}".format(testcase_dict["name"])) + testcase_name = testcase_dict["name"] self.test_runner_list.append((test_runner, variables)) self._add_test_to_suite(testcase_name, test_runner, testcase_dict)