support running oft from any working directory
diff --git a/tests/oft b/tests/oft
index 6cb9181..5297718 100755
--- a/tests/oft
+++ b/tests/oft
@@ -123,6 +123,7 @@
import unittest
import time
import os
+import imp
pydir = os.path.join(os.path.dirname(__file__), '..', 'src', 'python')
if os.path.exists(os.path.join(pydir, 'oftest')):
@@ -356,7 +357,10 @@
modname = os.path.splitext(os.path.basename(file))[0]
try:
- mod = __import__(modname)
+ if sys.modules.has_key(modname):
+ mod = sys.modules[modname]
+ else:
+ mod = imp.load_module(modname, *imp.find_module(modname, [os.path.dirname(file)]))
except:
logging.warning("Could not import file " + file)
raise