mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-06 08:19:45 +08:00
relocate functions
This commit is contained in:
@@ -3,7 +3,6 @@ import importlib
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import types
|
||||
from collections import OrderedDict
|
||||
|
||||
from ate import utils
|
||||
@@ -11,12 +10,6 @@ from ate.exception import ParamsError
|
||||
from ate.testcase import TestcaseParser
|
||||
|
||||
|
||||
def is_function(tup):
|
||||
""" Takes (name, object) tuple, returns True if it is a function.
|
||||
"""
|
||||
name, item = tup
|
||||
return isinstance(item, types.FunctionType)
|
||||
|
||||
class Context(object):
|
||||
""" Manages context functions and variables.
|
||||
context has two levels, testset and testcase.
|
||||
@@ -77,8 +70,7 @@ class Context(object):
|
||||
"""
|
||||
sys.path.insert(0, os.getcwd())
|
||||
for module_name in modules:
|
||||
imported = importlib.import_module(module_name)
|
||||
imported_functions_dict = dict(filter(is_function, vars(imported).items()))
|
||||
imported_functions_dict = utils.get_module_functions(module_name)
|
||||
self.__update_context_functions_config(level, imported_functions_dict)
|
||||
|
||||
def bind_variables(self, variable_binds, level="testcase"):
|
||||
|
||||
Reference in New Issue
Block a user