diff mbox series

python3-packaging: fix rare failures in tests/property/test_specifier_matching.py

Message ID 20260916135751.3526459-1-ross.burton@arm.com
State New
Headers show
Series python3-packaging: fix rare failures in tests/property/test_specifier_matching.py | expand

Commit Message

Ross Burton Sept. 16, 2026, 1:57 p.m. UTC
The packaging test suite uses Hypothesis, which generates data for test
suites dynamically. However there's a small chance that the test suite
fails as the generated data isn't usable, so apply a patch that has been
submitted upstream to improve the reliability of the data.

[ YOCTO #16403 ]

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../python3-packaging/reliable-test.patch     | 30 +++++++++++++++++++
 .../python/python3-packaging_26.3.bb          |  3 +-
 2 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/python/python3-packaging/reliable-test.patch
diff mbox series

Patch

diff --git a/meta/recipes-devtools/python/python3-packaging/reliable-test.patch b/meta/recipes-devtools/python/python3-packaging/reliable-test.patch
new file mode 100644
index 00000000000..1746c1d21e5
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-packaging/reliable-test.patch
@@ -0,0 +1,30 @@ 
+From 47b0db5b7b9a5fd9f4d1d3236e90f205c8b34625 Mon Sep 17 00:00:00 2001
+From: Christopher Pruijsen <christopher.pruijsen@gmail.com>
+Date: Fri, 11 Sep 2026 02:32:41 +0100
+Subject: [PATCH] test(specifiers): stop filtering compatible-release examples
+ by epoch
+
+assume() dropped most draws when the specifier and candidate epochs
+differed, so Hypothesis intermittently failed HealthCheck.filter_too_much.
+
+Upstream-Status: Submitted [https://github.com/pypa/packaging/pull/1409]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ tests/property/test_specifier_matching.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tests/property/test_specifier_matching.py b/tests/property/test_specifier_matching.py
+index 4552ce8ce..4aedafe56 100644
+--- a/tests/property/test_specifier_matching.py
++++ b/tests/property/test_specifier_matching.py
+@@ -205,7 +205,9 @@ def test_compatible_release_matches_expected_compatible(
+     ) -> None:
+         """~=V matches candidate iff candidate >= V and candidate matches the
+         prefix wildcard derived from V."""
+-        assume(spec_ver.epoch == candidate.epoch)
++        # Share an epoch without assume(), which rejects most draws and trips
++        # Hypothesis HealthCheck.filter_too_much.
++        candidate = candidate.__replace__(epoch=spec_ver.epoch)
+         spec = Specifier(f"~={spec_ver}")
+         result = candidate in spec
+         # Also check via the expanded form
diff --git a/meta/recipes-devtools/python/python3-packaging_26.3.bb b/meta/recipes-devtools/python/python3-packaging_26.3.bb
index 424ee12ceed..628d8d7aa14 100644
--- a/meta/recipes-devtools/python/python3-packaging_26.3.bb
+++ b/meta/recipes-devtools/python/python3-packaging_26.3.bb
@@ -5,7 +5,8 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=faadaedca9251a90b205c9167578ce91"
 
 SRC_URI[sha256sum] = "94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79"
 
-SRC_URI += "file://run-ptest.in"
+SRC_URI += "file://run-ptest.in \
+            file://reliable-test.patch"
 
 inherit pypi python_flit_core ptest