summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools/python
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2026-05-04 15:59:37 +0200
committerGyorgy Sarvari <skandigraun@gmail.com>2026-05-04 15:59:37 +0200
commitce8539c941f6fcbecaca4d16640ac105c0595589 (patch)
treeae6aed14efd94851cd4ea67db98c24bcb45bd8a9 /meta-python/recipes-devtools/python
parent1da9d7f2f941e81e51829d3ee0cd6ec3e4cc00b8 (diff)
downloadmeta-openembedded-ce8539c941f6fcbecaca4d16640ac105c0595589.tar.gz
python3-soupsieve: fix tests with Python 3.10.20kirkstone
The latest Python upgrade in oe-core has broken some ptests. This backported patch fixes them, they should work with both the latest and previous versions. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Diffstat (limited to 'meta-python/recipes-devtools/python')
-rw-r--r--meta-python/recipes-devtools/python/python3-soupsieve/0001-Adjustments-for-changes-in-HTML-parser-285.patch190
-rw-r--r--meta-python/recipes-devtools/python/python3-soupsieve_2.3.1.bb8
2 files changed, 194 insertions, 4 deletions
diff --git a/meta-python/recipes-devtools/python/python3-soupsieve/0001-Adjustments-for-changes-in-HTML-parser-285.patch b/meta-python/recipes-devtools/python/python3-soupsieve/0001-Adjustments-for-changes-in-HTML-parser-285.patch
new file mode 100644
index 0000000000..6e0d225b31
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-soupsieve/0001-Adjustments-for-changes-in-HTML-parser-285.patch
@@ -0,0 +1,190 @@
1From b799b964ef020f18daab3d0b7193b217e7412050 Mon Sep 17 00:00:00 2001
2From: Isaac Muse <faceless.shop@gmail.com>
3Date: Wed, 17 Dec 2025 19:33:55 -0700
4Subject: [PATCH] Adjustments for changes in HTML parser (#285)
5
6Fixes #284
7
8Fixes running with python 3.10.20
9Upstream-Status: Backport [https://github.com/facelessuser/soupsieve/commit/046ce54956a0c30120038561e53b40994d29de2c]
10
11Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
12---
13 soupsieve/css_match.py | 2 +-
14 tests/test_extra/test_soup_contains.py | 4 +++-
15 tests/test_level2/test_lang.py | 4 +++-
16 tests/test_level3/test_root.py | 11 ++++++++---
17 tests/test_level4/test_default.py | 4 +++-
18 tests/test_level4/test_dir.py | 4 +++-
19 tests/test_level4/test_indeterminate.py | 5 ++++-
20 7 files changed, 25 insertions(+), 9 deletions(-)
21
22diff --git a/soupsieve/css_match.py b/soupsieve/css_match.py
23index 79bb870..c168436 100644
24--- a/soupsieve/css_match.py
25+++ b/soupsieve/css_match.py
26@@ -1185,7 +1185,7 @@ class CSSMatch(_DocumentNav):
27 # Use cached meta language.
28 if not found_lang and self.cached_meta_lang:
29 for cache in self.cached_meta_lang:
30- if root is cache[0]:
31+ if root is not None and cast(str, root) is cache[0]:
32 found_lang = cache[1]
33
34 # If we couldn't find a language, and the document is HTML, look to meta to determine language.
35diff --git a/tests/test_extra/test_soup_contains.py b/tests/test_extra/test_soup_contains.py
36index 66240db..fdd8027 100644
37--- a/tests/test_extra/test_soup_contains.py
38+++ b/tests/test_extra/test_soup_contains.py
39@@ -2,7 +2,9 @@
40 from .. import util
41 import warnings
42 import soupsieve as sv
43+from bs4 import BeautifulSoup
44
45+IFRAME_TEXT = BeautifulSoup('<iframe><div></div></iframe>', 'html.parser').iframe.text == '<div></div>'
46
47 class TestSoupContains(util.TestCase):
48 """Test soup-contains selectors."""
49@@ -250,7 +252,7 @@ class TestSoupContains(util.TestCase):
50 self.assert_selector(
51 markup,
52 'span:-soup-contains("iframe")',
53- ['2'],
54+ [] if IFRAME_TEXT else ['2'],
55 flags=util.PYHTML
56 )
57
58diff --git a/tests/test_level2/test_lang.py b/tests/test_level2/test_lang.py
59index 83b9ee4..082921c 100644
60--- a/tests/test_level2/test_lang.py
61+++ b/tests/test_level2/test_lang.py
62@@ -1,6 +1,8 @@
63 """Test language selector."""
64 from .. import util
65+from bs4 import BeautifulSoup
66
67+IFRAME_TEXT = BeautifulSoup('<iframe><div></div></iframe>', 'html.parser').iframe.text == '<div></div>'
68
69 class TestLang(util.TestCase):
70 """Test language selector."""
71@@ -58,7 +60,7 @@ class TestLang(util.TestCase):
72 self.assert_selector(
73 markup,
74 "p:lang(en)",
75- ['3'],
76+ [] if IFRAME_TEXT else ['3'],
77 flags=util.PYHTML
78 )
79
80diff --git a/tests/test_level3/test_root.py b/tests/test_level3/test_root.py
81index 60f7e75..3c6843c 100644
82--- a/tests/test_level3/test_root.py
83+++ b/tests/test_level3/test_root.py
84@@ -1,6 +1,10 @@
85 """Test root selectors."""
86 from .. import util
87 import soupsieve as sv
88+from bs4 import BeautifulSoup
89+import pytest
90+
91+IFRAME_TEXT = BeautifulSoup('<iframe><div></div></iframe>', 'html.parser').iframe.text == '<div></div>'
92
93
94 class TestRoot(util.TestCase):
95@@ -65,7 +69,7 @@ class TestRoot(util.TestCase):
96 self.assert_selector(
97 self.MARKUP_IFRAME,
98 ":root",
99- ["root", "root2"],
100+ ["root"] if IFRAME_TEXT else ["root", "root2"],
101 flags=util.PYHTML
102 )
103
104@@ -85,17 +89,18 @@ class TestRoot(util.TestCase):
105 self.assert_selector(
106 self.MARKUP_IFRAME,
107 ":root div",
108- ["div", "div2", "other-div"],
109+ ["div", "other-div"] if IFRAME_TEXT else ["div", "div2", "other-div"],
110 flags=util.PYHTML
111 )
112
113 self.assert_selector(
114 self.MARKUP_IFRAME,
115 ":root > body > div",
116- ["div", "div2", "other-div"],
117+ ["div", "other-div"] if IFRAME_TEXT else ["div", "div2", "other-div"],
118 flags=util.PYHTML
119 )
120
121+ @pytest.mark.skipif(IFRAME_TEXT, reason="Requires old Python HTML handling")
122 def test_iframe(self):
123 """
124 Test that we only count `iframe` as root since the scoped element is the root.
125diff --git a/tests/test_level4/test_default.py b/tests/test_level4/test_default.py
126index 852948d..dd7b53a 100644
127--- a/tests/test_level4/test_default.py
128+++ b/tests/test_level4/test_default.py
129@@ -1,6 +1,8 @@
130 """Test default selectors."""
131 from .. import util
132+from bs4 import BeautifulSoup
133
134+IFRAME_TEXT = BeautifulSoup('<iframe><div></div></iframe>', 'html.parser').iframe.text == '<div></div>'
135
136 class TestDefault(util.TestCase):
137 """Test default selectors."""
138@@ -113,7 +115,7 @@ class TestDefault(util.TestCase):
139 self.assert_selector(
140 markup,
141 ":default",
142- ['d1', 'd3', 'd4'],
143+ ['d1', 'd3'] if IFRAME_TEXT else ['d1', 'd3', 'd4'],
144 flags=util.PYHTML
145 )
146
147diff --git a/tests/test_level4/test_dir.py b/tests/test_level4/test_dir.py
148index e427715..e1a68f2 100644
149--- a/tests/test_level4/test_dir.py
150+++ b/tests/test_level4/test_dir.py
151@@ -2,7 +2,9 @@
152 """Test direction selectors."""
153 from .. import util
154 import soupsieve as sv
155+from bs4 import BeautifulSoup
156
157+IFRAME_TEXT = BeautifulSoup('<iframe><div></div></iframe>', 'html.parser').iframe.text == '<div></div>'
158
159 class TestDir(util.TestCase):
160 """Test direction selectors."""
161@@ -170,7 +172,7 @@ class TestDir(util.TestCase):
162 self.assert_selector(
163 markup,
164 "div:dir(rtl)",
165- ['2'],
166+ [] if IFRAME_TEXT else ['2'],
167 flags=util.PYHTML
168 )
169
170diff --git a/tests/test_level4/test_indeterminate.py b/tests/test_level4/test_indeterminate.py
171index 8e949ff..6867dae 100644
172--- a/tests/test_level4/test_indeterminate.py
173+++ b/tests/test_level4/test_indeterminate.py
174@@ -1,5 +1,8 @@
175 """Test indeterminate selectors."""
176 from .. import util
177+from bs4 import BeautifulSoup
178+
179+IFRAME_TEXT = BeautifulSoup('<iframe><div></div></iframe>', 'html.parser').iframe.text == '<div></div>'
180
181
182 class TestIndeterminate(util.TestCase):
183@@ -68,6 +71,6 @@ class TestIndeterminate(util.TestCase):
184 self.assert_selector(
185 markup,
186 ":indeterminate",
187- ['radio1', 'radio3'],
188+ ['radio1'] if IFRAME_TEXT else ['radio1', 'radio3'],
189 flags=util.PYHTML
190 )
diff --git a/meta-python/recipes-devtools/python/python3-soupsieve_2.3.1.bb b/meta-python/recipes-devtools/python/python3-soupsieve_2.3.1.bb
index 0ef0c7e791..eec68682e4 100644
--- a/meta-python/recipes-devtools/python/python3-soupsieve_2.3.1.bb
+++ b/meta-python/recipes-devtools/python/python3-soupsieve_2.3.1.bb
@@ -8,10 +8,10 @@ SRC_URI[sha256sum] = "b8d49b1cd4f037c7082a9683dfa1801aa2597fb11c3a1155b7a5b94829
8 8
9inherit pypi python_setuptools_build_meta ptest 9inherit pypi python_setuptools_build_meta ptest
10 10
11SRC_URI += " \ 11SRC_URI += "file://run-ptest \
12 file://run-ptest \ 12 file://update_tests_for_latest_libxml.patch \
13 file://update_tests_for_latest_libxml.patch \ 13 file://0001-Adjustments-for-changes-in-HTML-parser-285.patch \
14" 14 "
15 15
16RDEPENDS:${PN}-ptest += " \ 16RDEPENDS:${PN}-ptest += " \
17 ${PYTHON_PN}-pytest \ 17 ${PYTHON_PN}-pytest \