commit:     a7c581c17cf5d123604e0eab833273b8792edc63
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 29 15:11:59 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 29 15:11:59 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a7c581c1

dev-python/soupsieve: skip tests broken due to known lxml bug

Using Debian's patch.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/soupsieve-2.2.1-lxml-libxml2-tests.patch | 64 ++++++++++++++++++++++
 ...ieve-2.2.1.ebuild => soupsieve-2.2.1-r1.ebuild} |  9 ++-
 2 files changed, 72 insertions(+), 1 deletion(-)

diff --git 
a/dev-python/soupsieve/files/soupsieve-2.2.1-lxml-libxml2-tests.patch 
b/dev-python/soupsieve/files/soupsieve-2.2.1-lxml-libxml2-tests.patch
new file mode 100644
index 00000000000..a7075fa6fb6
--- /dev/null
+++ b/dev-python/soupsieve/files/soupsieve-2.2.1-lxml-libxml2-tests.patch
@@ -0,0 +1,64 @@
+https://sources.debian.org/data/main/s/soupsieve/2.2.1-2/debian/patches/libxml2-2.9.11
+https://github.com/facelessuser/soupsieve/issues/220
+
+Apply Debian patch to skip tests which expose a lxml bug that's
+already being handled elsewhere.
+
+From: Stefano Rivera <[email protected]>
+Date: Sat, 2 Oct 2021 12:05:17 -0700
+Subject: Mark test_contains_cdata_html tests XFAIL for libxml2 >= 2.9.11
+
+libxml2 changed CDATA handling in 2.9.11.
+Beautifulsoup supports this change, but lxml upstream has pinned on an
+older version so the behaviour change isn't standardised upstream, yet.
+
+Bug-upstream: https://github.com/facelessuser/soupsieve/issues/220
+Bug-lxml: https://bugs.launchpad.net/lxml/+bug/1928795
+Bug-beautifulsoup: https://bugs.launchpad.net/beautifulsoup/+bug/1930164
+Bug-Debian: https://bugs.debian.org/995459
+
+Forwarded: no
+--- a/tests/test_extra/test_soup_contains.py
++++ b/tests/test_extra/test_soup_contains.py
+@@ -3,6 +3,9 @@ from .. import util
+ import warnings
+ import soupsieve as sv
+ 
++import pytest
++from lxml.etree import LIBXML_VERSION
++
+ 
+ class TestSoupContains(util.TestCase):
+     """Test soup-contains selectors."""
+@@ -144,6 +147,9 @@ class TestSoupContains(util.TestCase):
+             flags=util.HTML
+         )
+ 
++    @pytest.mark.xfail(LIBXML_VERSION >= (2, 9, 11),
++        reason='lxml parser changed CDATA handling, see '
++               'https://github.com/facelessuser/soupsieve/issues/220')
+     def test_contains_cdata_html(self):
+         """Test contains CDATA in HTML5."""
+ 
+--- a/tests/test_extra/test_soup_contains_own.py
++++ b/tests/test_extra/test_soup_contains_own.py
+@@ -1,6 +1,9 @@
+ """Test contains selectors."""
+ from .. import util
+ 
++import pytest
++from lxml.etree import LIBXML_VERSION
++
+ 
+ class TestSoupContainsOwn(util.TestCase):
+     """Test soup-contains-own selectors."""
+@@ -35,6 +38,9 @@ class TestSoupContainsOwn(util.TestCase):
+             flags=util.HTML
+         )
+ 
++    @pytest.mark.xfail(LIBXML_VERSION >= (2, 9, 11),
++        reason='lxml parser changed CDATA handling, see '
++               'https://github.com/facelessuser/soupsieve/issues/220')
+     def test_contains_own_cdata_html(self):
+         """Test contains CDATA in HTML5."""
+ 

diff --git a/dev-python/soupsieve/soupsieve-2.2.1.ebuild 
b/dev-python/soupsieve/soupsieve-2.2.1-r1.ebuild
similarity index 73%
rename from dev-python/soupsieve/soupsieve-2.2.1.ebuild
rename to dev-python/soupsieve/soupsieve-2.2.1-r1.ebuild
index c7f078edb7b..02ac9fda95f 100644
--- a/dev-python/soupsieve/soupsieve-2.2.1.ebuild
+++ b/dev-python/soupsieve/soupsieve-2.2.1-r1.ebuild
@@ -19,9 +19,16 @@ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc 
ppc64 ~riscv ~s390 s
 BDEPEND="
        test? (
                dev-python/beautifulsoup4[${PYTHON_USEDEP}]
-               <dev-python/lxml-4.6.3-r1[${PYTHON_USEDEP}]
+               dev-python/lxml[${PYTHON_USEDEP}]
                dev-python/html5lib[${PYTHON_USEDEP}]
        )
 "
 
+PATCHES=(
+       # Needed for now until something is figured out either at lxml
+       # upstream or libxml2?
+       # See https://github.com/facelessuser/soupsieve/issues/220
+       "${FILESDIR}"/${PN}-2.2.1-lxml-libxml2-tests.patch
+)
+
 distutils_enable_tests pytest

Reply via email to