From: R David Murray Date: Mon, 18 Mar 2013 04:18:12 +0000 (-0400) Subject: #17448: Make test_sax skip if there are no xml parsers. X-Git-Tag: v3.2.4rc1~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a846f5ace80977f922e8295441afc668910fc894;p=thirdparty%2FPython%2Fcpython.git #17448: Make test_sax skip if there are no xml parsers. Patch by Rafael Santos. --- diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py index bfa7d72d1644..3efd97245829 100644 --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -3,11 +3,12 @@ from xml.sax import make_parser, ContentHandler, \ SAXException, SAXReaderNotAvailable, SAXParseException +import unittest try: make_parser() except SAXReaderNotAvailable: # don't try to test this module if we cannot create a parser - raise ImportError("no XML parsers available") + raise unittest.SkipTest("no XML parsers available") from xml.sax.saxutils import XMLGenerator, escape, unescape, quoteattr, \ XMLFilterBase from xml.sax.expatreader import create_parser @@ -18,7 +19,6 @@ import os.path import shutil from test import support from test.support import findfile, run_unittest -import unittest TEST_XMLFILE = findfile("test.xml", subdir="xmltestdata") TEST_XMLFILE_OUT = findfile("test.xml.out", subdir="xmltestdata") diff --git a/Misc/ACKS b/Misc/ACKS index d8533c4351b2..b5c80592f5cd 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -947,6 +947,7 @@ Rich Salz Kevin Samborn Adrian Sampson Ilya Sandler +Rafael Santos Mark Sapiro Ty Sarna Hugh Sasse diff --git a/Misc/NEWS b/Misc/NEWS index c9c854dd2d57..af2231821bc9 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -967,6 +967,9 @@ Extension Modules Tests ----- +- Issue #17448: test_sax now skips if there are no xml parsers available + instead of raising an ImportError. + - Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. Initial patch by Thomas Wouters.