summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-23 07:38:54 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-23 07:39:00 -0400
commit4d3e89b06977362707ccb0d7f70311181b4e0da8 (patch)
tree07f5ec3e109e4058a22cf6a375056bae5773ef67 /testsuite
parent8b92e0ab89e96c7e810da89ccacecfaee3e142c2 (diff)
downloadbcfg2-4d3e89b06977362707ccb0d7f70311181b4e0da8.tar.gz
bcfg2-4d3e89b06977362707ccb0d7f70311181b4e0da8.tar.bz2
bcfg2-4d3e89b06977362707ccb0d7f70311181b4e0da8.zip
removed relative imports from testsuite for py2.4 compat
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDevice.py18
-rw-r--r--testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDirectory.py18
-rw-r--r--testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestFile.py18
-rw-r--r--testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestHardlink.py18
-rw-r--r--testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestNonexistent.py18
-rw-r--r--testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestPermissions.py2
-rw-r--r--testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestSymlink.py18
-rw-r--r--testsuite/Testlib/TestClient/TestTools/TestPOSIX/Test__init.py14
-rw-r--r--testsuite/Testlib/TestClient/TestTools/TestPOSIX/Testbase.py16
-rw-r--r--testsuite/Testlib/TestOptions.py17
-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
13 files changed, 155 insertions, 41 deletions
diff --git a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDevice.py b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDevice.py
index 1130199b4..fb80991d7 100644
--- a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDevice.py
+++ b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDevice.py
@@ -1,12 +1,22 @@
import os
+import sys
import copy
import lxml.etree
from mock import Mock, MagicMock, patch
from Bcfg2.Client.Tools.POSIX.Device import *
-from .Test__init import get_posix_object
-from .Testbase import TestPOSIXTool
-# 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 Test__init import get_posix_object
+from Testbase import TestPOSIXTool
+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/TestClient/TestTools/TestPOSIX/TestDirectory.py b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDirectory.py
index 8c403ed85..e01bd7453 100644
--- a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDirectory.py
+++ b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDirectory.py
@@ -1,13 +1,23 @@
import os
+import sys
import stat
import copy
import lxml.etree
from mock import Mock, MagicMock, patch
from Bcfg2.Client.Tools.POSIX.Directory import *
-from .Test__init import get_posix_object
-from .Testbase import TestPOSIXTool
-# 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 Test__init import get_posix_object
+from Testbase import TestPOSIXTool
+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/TestClient/TestTools/TestPOSIX/TestFile.py b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestFile.py
index b8b006100..5b6d3b1dc 100644
--- a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestFile.py
+++ b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestFile.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import os
+import sys
import copy
import difflib
import binascii
@@ -7,10 +8,19 @@ import lxml.etree
from Bcfg2.Bcfg2Py3k import b64encode, b64decode, u_str
from mock import Mock, MagicMock, patch
from Bcfg2.Client.Tools.POSIX.File import *
-from .Test__init import get_posix_object
-from .Testbase import TestPOSIXTool
-# 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 Test__init import get_posix_object
+from Testbase import TestPOSIXTool
+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/TestClient/TestTools/TestPOSIX/TestHardlink.py b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestHardlink.py
index af6834246..d68e15837 100644
--- a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestHardlink.py
+++ b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestHardlink.py
@@ -1,12 +1,22 @@
import os
+import sys
import copy
import lxml.etree
from mock import Mock, MagicMock, patch
from Bcfg2.Client.Tools.POSIX.Hardlink import *
-from .Test__init import get_posix_object
-from .Testbase import TestPOSIXTool
-# 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 Test__init import get_posix_object
+from Testbase import TestPOSIXTool
+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/TestClient/TestTools/TestPOSIX/TestNonexistent.py b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestNonexistent.py
index b785e3b1f..375ff00eb 100644
--- a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestNonexistent.py
+++ b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestNonexistent.py
@@ -1,12 +1,22 @@
import os
+import sys
import copy
import lxml.etree
from mock import Mock, MagicMock, patch
from Bcfg2.Client.Tools.POSIX.Nonexistent import *
-from .Test__init import get_config, get_posix_object
-from .Testbase import TestPOSIXTool
-# 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 Test__init import get_config, get_posix_object
+from Testbase import TestPOSIXTool
+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/TestClient/TestTools/TestPOSIX/TestPermissions.py b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestPermissions.py
index a9b71ec2c..565857437 100644
--- a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestPermissions.py
+++ b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestPermissions.py
@@ -1,5 +1,5 @@
from Bcfg2.Client.Tools.POSIX.Permissions import *
-from .Testbase import TestPOSIXTool
+from Testbase import TestPOSIXTool
class TestPOSIXPermissions(TestPOSIXTool):
test_obj = POSIXPermissions
diff --git a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestSymlink.py b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestSymlink.py
index 9f8710e5d..c825e5476 100644
--- a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestSymlink.py
+++ b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestSymlink.py
@@ -1,12 +1,22 @@
import os
+import sys
import copy
import lxml.etree
from mock import Mock, MagicMock, patch
from Bcfg2.Client.Tools.POSIX.Symlink import *
-from .Test__init import get_posix_object
-from .Testbase import TestPOSIXTool
-# 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 Test__init import get_posix_object
+from Testbase import TestPOSIXTool
+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/TestClient/TestTools/TestPOSIX/Test__init.py b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/Test__init.py
index 5242df509..14a2520df 100644
--- a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/Test__init.py
+++ b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/Test__init.py
@@ -1,10 +1,20 @@
import os
+import sys
import lxml.etree
from mock import Mock, MagicMock, patch
import Bcfg2.Client.Tools
import Bcfg2.Client.Tools.POSIX
-# 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/TestClient/TestTools/TestPOSIX/Testbase.py b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/Testbase.py
index 06585bb80..b447ab642 100644
--- a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/Testbase.py
+++ b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/Testbase.py
@@ -1,13 +1,23 @@
import os
+import sys
import copy
import stat
import lxml.etree
from mock import Mock, MagicMock, patch
import Bcfg2.Client.Tools
from Bcfg2.Client.Tools.POSIX.base import *
-from .Test__init import get_posix_object
-# 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 Test__init import get_posix_object
+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/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):
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