Skip to content

Commit d85c6de

Browse files
committed
Exclude a test when using the macOS system libraries because it fails with libxml2 2.9.4.
1 parent cd4bec9 commit d85c6de

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/lxml/tests/common_imports.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ def dummy_test_method(self):
6969
if expected_version > current_version:
7070
setattr(test_class, name, dummy_test_method)
7171

72+
73+
def needs_libxml(*version):
74+
return unittest.skipIf(
75+
etree.LIBXML_VERSION >= version,
76+
"needs libxml2 >= %s.%s.%s" % (version + (0, 0, 0))[:3])
77+
78+
7279
import doctest
7380

7481
try:

src/lxml/tests/test_htmlparser.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import tempfile, os, os.path, sys
1111

1212
from .common_imports import etree, html, BytesIO, fileInTestDir, _bytes, _str
13-
from .common_imports import SillyFileLike, HelperTestCase, write_to_file
13+
from .common_imports import SillyFileLike, HelperTestCase, write_to_file, needs_libxml
1414

1515
try:
1616
unicode
@@ -53,7 +53,8 @@ def test_module_HTML_unicode(self):
5353
self.assertEqual(element.findtext('.//h1'),
5454
_bytes("page á title").decode('utf8'))
5555

56-
def test_wide_unicode_xml(self):
56+
@needs_libxml(2, 9, 5) # not sure, at least 2.9.4 fails
57+
def test_wide_unicode_html(self):
5758
if sys.maxunicode < 1114111:
5859
return # skip test
5960
element = self.etree.HTML(_bytes(

src/lxml/tests/test_unicode.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import unittest
55
import sys
66

7-
from .common_imports import StringIO, etree, HelperTestCase, _str, _bytes, _chr
7+
from .common_imports import StringIO, etree, HelperTestCase, _str, _bytes, _chr, needs_libxml
88

99
try:
1010
unicode
@@ -34,6 +34,7 @@ def test_unicode_xml(self):
3434
tree = etree.XML('<p>%s</p>' % uni)
3535
self.assertEqual(uni, tree.text)
3636

37+
@needs_libxml(2, 9, 5) # not sure, at least 2.9.4 fails
3738
def test_wide_unicode_xml(self):
3839
if sys.maxunicode < 1114111:
3940
return # skip test

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy