summaryrefslogtreecommitdiffstats
path: root/testsuite/Testlib/TestOptions.py
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/Testlib/TestOptions.py')
-rw-r--r--testsuite/Testlib/TestOptions.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/testsuite/Testlib/TestOptions.py b/testsuite/Testlib/TestOptions.py
index b3bd51eed..acb5c9bfc 100644
--- a/testsuite/Testlib/TestOptions.py
+++ b/testsuite/Testlib/TestOptions.py
@@ -2,14 +2,21 @@ import os
import sys
from mock import Mock, MagicMock, patch
from Bcfg2.Options import *
-# python 2.5 can't import * from relative imports
-from ..common import XI_NAMESPACE, XI, inPy3k, call, builtins, u, can_skip, \
+from Bcfg2.Bcfg2Py3k import ConfigParser
+
+# 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
-# Compatibility imports
-from Bcfg2.Bcfg2Py3k import ConfigParser
-
class TestDefaultConfigParser(Bcfg2TestCase):
@patch("%s.ConfigParser.get" % ConfigParser.__name__)
def test_get(self, mock_get):