Commit d174ecff authored by Martijn Pieters's avatar Martijn Pieters

Make sure that the path we import a test module from, is in sys.path. This

allows such a module to import other modules in the same directory.
parent 8531f664
......@@ -53,8 +53,12 @@ class TestRunner:
path, filename=os.path.split(filepath)
name, ext=os.path.splitext(filename)
file, pathname, desc=imp.find_module(name, [path])
# Add path of imported module to sys.path, so local imports work.
sys.path.insert(0, path)
try: module=imp.load_module(name, file, pathname, desc)
finally: file.close()
# Remove extra path again.
sys.path.remove(path)
function=getattr(module, 'test_suite', None)
if function is None:
return None
......
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