summaryrefslogtreecommitdiffstats
path: root/testsuite/Testlib/TestServer
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/Testlib/TestServer')
-rw-r--r--testsuite/Testlib/TestServer/TestPlugin.py13
-rw-r--r--testsuite/Testlib/TestServer/TestPlugins/TestMetadata.py13
-rw-r--r--testsuite/Testlib/TestServer/TestPlugins/TestProbes.py13
3 files changed, 33 insertions, 6 deletions
diff --git a/testsuite/Testlib/TestServer/TestPlugin.py b/testsuite/Testlib/TestServer/TestPlugin.py
index 14e37f36b..be345b0d1 100644
--- a/testsuite/Testlib/TestServer/TestPlugin.py
+++ b/testsuite/Testlib/TestServer/TestPlugin.py
@@ -8,8 +8,17 @@ import Bcfg2.Server
from Bcfg2.Bcfg2Py3k import reduce
from mock import Mock, MagicMock, patch
from Bcfg2.Server.Plugin import *
-# python 2.5 can't import * from relative imports
-from ...common import XI_NAMESPACE, XI, inPy3k, call, builtins, u, can_skip, \
+
+# add all parent testsuite directories to sys.path to allow (most)
+# relative imports in python 2.4
+path = os.path.dirname(__file__)
+while path != '/':
+ if os.path.basename(path).lower().startswith("test"):
+ sys.path.append(path)
+ if os.path.basename(path) == "testsuite":
+ break
+ path = os.path.dirname(path)
+from common import XI_NAMESPACE, XI, inPy3k, call, builtins, u, can_skip, \
skip, skipIf, skipUnless, Bcfg2TestCase, DBModelTestCase, syncdb, \
patchIf, datastore
diff --git a/testsuite/Testlib/TestServer/TestPlugins/TestMetadata.py b/testsuite/Testlib/TestServer/TestPlugins/TestMetadata.py
index c5569c2b6..4c0073dfd 100644
--- a/testsuite/Testlib/TestServer/TestPlugins/TestMetadata.py
+++ b/testsuite/Testlib/TestServer/TestPlugins/TestMetadata.py
@@ -5,8 +5,17 @@ import time
import socket
import lxml.etree
from mock import Mock, patch
-# python 2.5 can't import * from relative imports
-from ....common import XI_NAMESPACE, XI, inPy3k, call, builtins, u, can_skip, \
+
+# add all parent testsuite directories to sys.path to allow (most)
+# relative imports in python 2.4
+path = os.path.dirname(__file__)
+while path != "/":
+ if os.path.basename(path).lower().startswith("test"):
+ sys.path.append(path)
+ if os.path.basename(path) == "testsuite":
+ break
+ path = os.path.dirname(path)
+from common import XI_NAMESPACE, XI, inPy3k, call, builtins, u, can_skip, \
skip, skipIf, skipUnless, Bcfg2TestCase, DBModelTestCase, syncdb, \
patchIf, datastore
import Bcfg2.Server
diff --git a/testsuite/Testlib/TestServer/TestPlugins/TestProbes.py b/testsuite/Testlib/TestServer/TestPlugins/TestProbes.py
index 3457444b2..743ef508b 100644
--- a/testsuite/Testlib/TestServer/TestPlugins/TestProbes.py
+++ b/testsuite/Testlib/TestServer/TestPlugins/TestProbes.py
@@ -3,8 +3,17 @@ import sys
import time
import lxml.etree
from mock import Mock, MagicMock, patch
-# python 2.5 can't import * from relative imports
-from ....common import XI_NAMESPACE, XI, inPy3k, call, builtins, u, can_skip, \
+
+# add all parent testsuite directories to sys.path to allow (most)
+# relative imports in python 2.4
+path = os.path.dirname(__file__)
+while path != "/":
+ if os.path.basename(path).lower().startswith("test"):
+ sys.path.append(path)
+ if os.path.basename(path) == "testsuite":
+ break
+ path = os.path.dirname(path)
+from common import XI_NAMESPACE, XI, inPy3k, call, builtins, u, can_skip, \
skip, skipIf, skipUnless, Bcfg2TestCase, DBModelTestCase, syncdb, \
patchIf, datastore
import Bcfg2.Server