diff options
| author | Stefan Behnel <stefan_ml@behnel.de> | 2021-12-10 21:00:29 +0100 |
|---|---|---|
| committer | Stefan Behnel <stefan_ml@behnel.de> | 2021-12-10 21:00:29 +0100 |
| commit | d083b8d7f4121aed6e2e99a06fbb85d41ad9e550 (patch) | |
| tree | 9ee7dd257d6731b4fe978588bc70fd45d759eb80 | |
| parent | cc1028fda607eb264c94d6535f2639138a8297c7 (diff) | |
| download | python-lxml-d083b8d7f4121aed6e2e99a06fbb85d41ad9e550.tar.gz | |
Exclude a test when using the macOS system libraries because it fails with libxml2 2.9.4.
| -rw-r--r-- | src/lxml/tests/common_imports.py | 7 | ||||
| -rw-r--r-- | src/lxml/tests/test_htmlparser.py | 5 | ||||
| -rw-r--r-- | src/lxml/tests/test_unicode.py | 3 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/lxml/tests/common_imports.py b/src/lxml/tests/common_imports.py index 0a6cbbfa..53780d99 100644 --- a/src/lxml/tests/common_imports.py +++ b/src/lxml/tests/common_imports.py @@ -69,6 +69,13 @@ def filter_by_version(test_class, version_dict, current_version): if expected_version > current_version: setattr(test_class, name, dummy_test_method) + +def needs_libxml(*version): + return unittest.skipIf( + etree.LIBXML_VERSION >= version, + "needs libxml2 >= %s.%s.%s" % (version + (0, 0, 0))[:3]) + + import doctest try: diff --git a/src/lxml/tests/test_htmlparser.py b/src/lxml/tests/test_htmlparser.py index 9847d39b..4460c1d4 100644 --- a/src/lxml/tests/test_htmlparser.py +++ b/src/lxml/tests/test_htmlparser.py @@ -10,7 +10,7 @@ import unittest import tempfile, os, os.path, sys from .common_imports import etree, html, BytesIO, fileInTestDir, _bytes, _str -from .common_imports import SillyFileLike, HelperTestCase, write_to_file +from .common_imports import SillyFileLike, HelperTestCase, write_to_file, needs_libxml try: unicode @@ -53,7 +53,8 @@ class HtmlParserTestCase(HelperTestCase): self.assertEqual(element.findtext('.//h1'), _bytes("page á title").decode('utf8')) - def test_wide_unicode_xml(self): + @needs_libxml(2, 9, 5) # not sure, at least 2.9.4 fails + def test_wide_unicode_html(self): if sys.maxunicode < 1114111: return # skip test element = self.etree.HTML(_bytes( diff --git a/src/lxml/tests/test_unicode.py b/src/lxml/tests/test_unicode.py index 03ffcba4..287a0f0f 100644 --- a/src/lxml/tests/test_unicode.py +++ b/src/lxml/tests/test_unicode.py @@ -4,7 +4,7 @@ from __future__ import absolute_import import unittest import sys -from .common_imports import StringIO, etree, HelperTestCase, _str, _bytes, _chr +from .common_imports import StringIO, etree, HelperTestCase, _str, _bytes, _chr, needs_libxml try: unicode @@ -34,6 +34,7 @@ class UnicodeTestCase(HelperTestCase): tree = etree.XML('<p>%s</p>' % uni) self.assertEqual(uni, tree.text) + @needs_libxml(2, 9, 5) # not sure, at least 2.9.4 fails def test_wide_unicode_xml(self): if sys.maxunicode < 1114111: return # skip test |
