From f95351cc6ecd06a7b6c6921b8f793d754cf7f524 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 1 Mar 2018 00:13:25 +0800 Subject: [PATCH] #106: add callable to check if it is function --- httprunner/testcase.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/httprunner/testcase.py b/httprunner/testcase.py index cdb42d3b..503bd046 100644 --- a/httprunner/testcase.py +++ b/httprunner/testcase.py @@ -705,8 +705,13 @@ class TestcaseParser(object): return self.functions[item_name] try: - return eval(item_name) - except NameError: + # check if builtin functions + item_func = eval(item_name) + if callable(item_func): + # is builtin function + return item_func + except (NameError, TypeError): + # is not builtin function, continue to search pass elif item_type == "variable": if item_name in self.variables: