diff --git a/runtests.py b/runtests.py
index 2ebb4cc..9fd5f70 100755
--- a/runtests.py
+++ b/runtests.py
@@ -21,6 +21,10 @@ sys.path[0] = os.getcwd()
# find all of the planet test modules
modules = map(fullmodname, glob.glob(os.path.join('tests', 'test_*.py')))
+# enable warnings
+import planet
+planet.getLogger("WARNING")
+
# load all of the tests into a suite
suite = unittest.TestLoader().loadTestsFromNames(modules)
diff --git a/tests/test_apply.py b/tests/test_apply.py
index 7fece6d..dce69c1 100644
--- a/tests/test_apply.py
+++ b/tests/test_apply.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import unittest, os, shutil
-from planet import config, splice
+from planet import config, splice, logger
from xml.dom import minidom
workdir = 'tests/work/apply'
@@ -62,3 +62,26 @@ class ApplyTest(unittest.TestCase):
self.assertTrue(html.find('
test planet
')>=0)
self.assertTrue(html.find(
'')>=0)
+
+try:
+ import libxml2
+except ImportError:
+
+ try:
+ import win32pipe
+ (stdin,stdout) = win32pipe.popen4('xsltproc -V', 't')
+ stdin.close()
+ stdout.read()
+ try:
+ exitcode = stdout.close()
+ except IOError:
+ exitcode = -1
+ except:
+ import commands
+ (exitstatus,output) = commands.getstatusoutput('xsltproc -V')
+ exitcode = ((exitstatus>>8) & 0xFF)
+
+ if exitcode:
+ logger.warn("xsltproc is not available => can't test XSLT templates")
+ for method in dir(ApplyTest):
+ if method.startswith('test_'): delattr(ApplyTest,method)
diff --git a/tests/test_filters.py b/tests/test_filters.py
index 296e39f..f979946 100644
--- a/tests/test_filters.py
+++ b/tests/test_filters.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import unittest, xml.dom.minidom
-from planet import shell, config
+from planet import shell, config, logger
class FilterTests(unittest.TestCase):
@@ -80,12 +80,10 @@ try:
from subprocess import Popen, PIPE
sed=Popen(['sed','--version'],stdout=PIPE,stderr=PIPE)
sed.communicate()
- if sed.returncode != 0: raise Exception
-except Exception, expr:
- # sed is not available
- del FilterTests.test_stripAd_yahoo
-
- if isinstance(expr, ImportError):
- # Popen is not available
- for method in dir(FilterTests):
- if method.startswith('test_'): delattr(FilterTests,method)
+ if sed.returncode != 0:
+ logger.warn("sed is not available => can't test stripAd_yahoo")
+ del FilterTests.test_stripAd_yahoo
+except ImportError:
+ logger.warn("Popen is not available => can't test filters")
+ for method in dir(FilterTests):
+ if method.startswith('test_'): delattr(FilterTests,method)
diff --git a/tests/test_foaf.py b/tests/test_foaf.py
index 29f6328..ace44c8 100644
--- a/tests/test_foaf.py
+++ b/tests/test_foaf.py
@@ -3,7 +3,7 @@
import unittest, os, shutil
from planet.foaf import foaf2config
from ConfigParser import ConfigParser
-from planet import config
+from planet import config, logger
workdir = 'tests/work/config/cache'
@@ -119,6 +119,7 @@ class FoafTest(unittest.TestCase):
try:
import RDF
except:
+ logger.warn("Redland RDF is not available => can't test FOAF reading lists")
for key in FoafTest.__dict__.keys():
if key.startswith('test_'): delattr(FoafTest, key)