From f8cdb907a81bd4aa75408c57224ea1be3e90b5a6 Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Sat, 21 Apr 2007 16:33:47 -0400 Subject: [PATCH] Fixed items noticed during the upgrade to Feisty * dependency on non-spec compliant feature of xsltproc * workaround Python 2.5 regression (bug 1704790) * make Genshi message initial-caps --- filters/addsearch.xslt | 11 +++++------ tests/test_filter_genshi.py | 2 +- tests/test_filter_xslt.py | 14 ++++++++++---- tests/test_filters.py | 24 ++++++++++++++++-------- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/filters/addsearch.xslt b/filters/addsearch.xslt index 0d77ca6..aa8c581 100644 --- a/filters/addsearch.xslt +++ b/filters/addsearch.xslt @@ -1,14 +1,13 @@ + xmlns="http://www.w3.org/1999/xhtml"> - Search - +

Search

+
@@ -30,7 +29,7 @@ - + diff --git a/tests/test_filter_genshi.py b/tests/test_filter_genshi.py index a2f7bb4..c7a8baf 100644 --- a/tests/test_filter_genshi.py +++ b/tests/test_filter_genshi.py @@ -17,6 +17,6 @@ class GenshiFilterTests(unittest.TestCase): try: import genshi except: - logger.warn("genshi is not available => can't test genshi filters") + logger.warn("Genshi is not available => can't test genshi filters") for method in dir(GenshiFilterTests): if method.startswith('test_'): delattr(GenshiFilterTests,method) diff --git a/tests/test_filter_xslt.py b/tests/test_filter_xslt.py index 05890c2..46c4e82 100644 --- a/tests/test_filter_xslt.py +++ b/tests/test_filter_xslt.py @@ -28,10 +28,16 @@ try: import libxslt except: try: - from subprocess import Popen, PIPE - xsltproc=Popen(['xsltproc','--version'],stdout=PIPE,stderr=PIPE) - xsltproc.communicate() - if xsltproc.returncode != 0: raise ImportError + try: + # Python 2.5 bug 1704790 workaround (alas, Unix only) + import commands + if commands.getstatusoutput('xsltproc --version')[0] != 0: + raise ImportError + except: + from subprocess import Popen, PIPE + xsltproc=Popen(['xsltproc','--version'],stdout=PIPE,stderr=PIPE) + xsltproc.communicate() + if xsltproc.returncode != 0: raise ImportError except: logger.warn("libxslt is not available => can't test xslt filters") del XsltFilterTests.test_xslt_filter diff --git a/tests/test_filters.py b/tests/test_filters.py index 7915667..e8b9488 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -133,14 +133,22 @@ class FilterTests(unittest.TestCase): try: from subprocess import Popen, PIPE - _no_sed = False - try: - sed = Popen(['sed','--version'],stdout=PIPE,stderr=PIPE) - sed.communicate() - if sed.returncode != 0: - _no_sed = True - except WindowsError: - _no_sed = True + _no_sed = True + if _no_sed: + try: + # Python 2.5 bug 1704790 workaround (alas, Unix only) + import commands + if commands.getstatusoutput('sed --version')[0]==0: _no_sed = False + except: + pass + + if _no_sed: + try: + sed = Popen(['sed','--version'],stdout=PIPE,stderr=PIPE) + sed.communicate() + if sed.returncode == 0: _no_sed = False + except WindowsError: + pass if _no_sed: logger.warn("sed is not available => can't test stripAd_yahoo")