summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-23 07:59:37 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-23 07:59:37 -0400
commitec0cd6ea9edd655b748e44b5d9d846870c12b8e3 (patch)
tree5b07d9b5bc8fdca33caec4f5cacebaa7913ceb43 /testsuite
parent99fc1b0724ecef423c50bdf13666f6633c3765ef (diff)
downloadbcfg2-ec0cd6ea9edd655b748e44b5d9d846870c12b8e3.tar.gz
bcfg2-ec0cd6ea9edd655b748e44b5d9d846870c12b8e3.tar.bz2
bcfg2-ec0cd6ea9edd655b748e44b5d9d846870c12b8e3.zip
portable way to get regex type
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/Testlib/TestServer/TestPlugin.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/testsuite/Testlib/TestServer/TestPlugin.py b/testsuite/Testlib/TestServer/TestPlugin.py
index be345b0d1..e8a723b8e 100644
--- a/testsuite/Testlib/TestServer/TestPlugin.py
+++ b/testsuite/Testlib/TestServer/TestPlugin.py
@@ -22,6 +22,12 @@ from common import XI_NAMESPACE, XI, inPy3k, call, builtins, u, can_skip, \
skip, skipIf, skipUnless, Bcfg2TestCase, DBModelTestCase, syncdb, \
patchIf, datastore
+
+try:
+ re_type = re._pattern_type
+except AttributeError:
+ re_type = type(re.compile(""))
+
def tostring(el):
return lxml.etree.tostring(el, xml_declaration=False).decode('UTF-8')
@@ -1686,7 +1692,7 @@ class TestEntrySet(TestDebuggable):
def test__init(self):
for basename in self.basenames:
eset = self.get_obj(basename=basename)
- self.assertIsInstance(eset.specific, re._pattern_type)
+ self.assertIsInstance(eset.specific, re_type)
self.assertTrue(eset.specific.match(os.path.join(datastore,
basename)))
ppath = os.path.join(datastore, "Plugin", basename)