make custom module importable anywhere

This commit is contained in:
debugtalk
2017-07-20 10:32:58 +08:00
parent 2179092ea7
commit 9e154cea97

View File

@@ -1,6 +1,8 @@
import copy
import importlib
import os
import re
import sys
import types
from collections import OrderedDict
@@ -67,6 +69,7 @@ class Context(object):
def import_module_functions(self, modules, level="testcase"):
""" import modules and bind all functions within the context
"""
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()))