Skip to content

Commit a846f5a

Browse files
committed
#17448: Make test_sax skip if there are no xml parsers.
Patch by Rafael Santos.
1 parent dd24617 commit a846f5a

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Lib/test/test_sax.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
from xml.sax import make_parser, ContentHandler, \
55
SAXException, SAXReaderNotAvailable, SAXParseException
6+
import unittest
67
try:
78
make_parser()
89
except SAXReaderNotAvailable:
910
# don't try to test this module if we cannot create a parser
10-
raise ImportError("no XML parsers available")
11+
raise unittest.SkipTest("no XML parsers available")
1112
from xml.sax.saxutils import XMLGenerator, escape, unescape, quoteattr, \
1213
XMLFilterBase
1314
from xml.sax.expatreader import create_parser
@@ -18,7 +19,6 @@
1819
import shutil
1920
from test import support
2021
from test.support import findfile, run_unittest
21-
import unittest
2222

2323
TEST_XMLFILE = findfile("test.xml", subdir="xmltestdata")
2424
TEST_XMLFILE_OUT = findfile("test.xml.out", subdir="xmltestdata")

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,7 @@ Rich Salz
947947
Kevin Samborn
948948
Adrian Sampson
949949
Ilya Sandler
950+
Rafael Santos
950951
Mark Sapiro
951952
Ty Sarna
952953
Hugh Sasse

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,9 @@ Extension Modules
967967
Tests
968968
-----
969969

970+
- Issue #17448: test_sax now skips if there are no xml parsers available
971+
instead of raising an ImportError.
972+
970973
- Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set.
971974
Initial patch by Thomas Wouters.
972975

0 commit comments

Comments
 (0)