Commit 5c30a145 authored by Benjamin Blanc's avatar Benjamin Blanc

util: benchmark: argument: Add searchable path to

Add an path list argument to objectFromModule in order to search
module into.
parent d7c02f2c
......@@ -41,7 +41,7 @@ class ArgumentType(object):
@classmethod
def objectFromModule(cls, module_name, object_name=None,
callable_object=False):
callable_object=False, searchable_path_list=None):
if module_name.endswith('.py'):
module_name = module_name[:-3]
......@@ -51,6 +51,10 @@ class ArgumentType(object):
import sys
sys.path.append(os.getcwd())
if searchable_path_list:
for path in searchable_path_list:
sys.path.append(path)
try:
module = __import__(module_name, globals(), locals(), [object_name], -1)
except Exception, e:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment