diff mbox series

[meta-python,11/16] python3-typing-inspection: skip test broken by CPython 3.13.15 Literal dedup

Message ID 20260829001108.559544-11-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-python,01/16] python3-bleak: fetch git tag with tests/ for ptest instead of PyPI sdist | expand

Commit Message

Khem Raj Aug. 29, 2026, 12:11 a.m. UTC
From: Khem Raj <raj.khem@gmail.com>

test_literal_values_unhashable_type asserts that duplicate unhashable
Literal values (e.g. Literal[[1, 'a'], [1, 'a']]) are preserved, but
CPython 3.13.15+ deduplicates unhashable Literal args at construction
time (python/cpython#153914). Upstream fixed this the same way
starting in 0.4.4 by skipping the test on newer Python; backport that
same guard here since this recipe is pinned to 0.4.2.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../python/python3-typing-inspection_0.4.4.bb        | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-typing-inspection_0.4.4.bb b/meta-python/recipes-devtools/python/python3-typing-inspection_0.4.4.bb
index ce601d79b8..7694732817 100644
--- a/meta-python/recipes-devtools/python/python3-typing-inspection_0.4.4.bb
+++ b/meta-python/recipes-devtools/python/python3-typing-inspection_0.4.4.bb
@@ -12,4 +12,16 @@  RDEPENDS:${PN}-ptest += "python3-typing-extensions"
 
 PYPI_PACKAGE = "typing_inspection"
 
+do_install_ptest:append() {
+	# test_literal_values_unhashable_type asserts that duplicate unhashable
+	# Literal values (e.g. Literal[[1, 'a'], [1, 'a']]) are preserved, but
+	# CPython 3.13.15+ deduplicates unhashable Literal args at construction
+	# time (https://github.com/python/cpython/pull/153914). Upstream fixed
+	# this the same way starting in 0.4.4 by skipping the test on newer
+	# Python; backport that same guard here since we're pinned to 0.4.2.
+	sed -i \
+		-e "/^def test_literal_values_unhashable_type/i @pytest.mark.skipif(sys.version_info >= (3, 13, 15), reason='Unhashable arguments are deduplicated (https://github.com/python/cpython/pull/153914)')" \
+		${D}${PTEST_PATH}/tests/introspection/test_literal_values.py
+}
+
 BBCLASSEXTEND += "native nativesdk"