diff mbox series

[v4] python3-packaging: upgrade 25.0 -> 26.0

Message ID 20260206072205.1435-1-wangmy@fujitsu.com
State New
Headers show
Series [v4] python3-packaging: upgrade 25.0 -> 26.0 | expand

Commit Message

Wang Mingyu Feb. 6, 2026, 7:22 a.m. UTC
From: Wang Mingyu <wangmy@fujitsu.com>

Add patch to fix ptest error:
The test_toml_roundtrip test requires tomli_w for TOML serialization
comparison. Skip this specific test while allowing all other tests to run.

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
---
 ...sing-tomli_w-gracefully-in-test_pylo.patch | 54 +++++++++++++++++++
 ...ging_25.0.bb => python3-packaging_26.0.bb} |  5 +-
 2 files changed, 57 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/python/python3-packaging/0001-tests-Handle-missing-tomli_w-gracefully-in-test_pylo.patch
 rename meta/recipes-devtools/python/{python3-packaging_25.0.bb => python3-packaging_26.0.bb} (85%)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/python/python3-packaging/0001-tests-Handle-missing-tomli_w-gracefully-in-test_pylo.patch b/meta/recipes-devtools/python/python3-packaging/0001-tests-Handle-missing-tomli_w-gracefully-in-test_pylo.patch
new file mode 100644
index 0000000000..85dd244c45
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-packaging/0001-tests-Handle-missing-tomli_w-gracefully-in-test_pylo.patch
@@ -0,0 +1,54 @@ 
+From fa918b8dec1794d089419a316bb13ce97ca6cf80 Mon Sep 17 00:00:00 2001
+From: Wang Mingyu <wangmy@fujitsu.com>
+Date: Fri, 6 Feb 2026 03:25:14 +0000
+Subject: [PATCH] tests: Handle missing tomli_w gracefully in test_pylock.py
+
+The test_toml_roundtrip test requires tomli_w for TOML serialization
+comparison. Since tomli_w is not available, skip this
+specific test while allowing all other tests to run.
+
+Upstream-Status: Inappropriate [ptest specific]
+
+Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
+---
+ tests/test_pylock.py | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/tests/test_pylock.py b/tests/test_pylock.py
+index 1e3d957..6bfdbe9 100644
+--- a/tests/test_pylock.py
++++ b/tests/test_pylock.py
+@@ -5,8 +5,17 @@ import sys
+ from pathlib import Path
+ from typing import Any
+ 
++# Import tomli_w conditionally
++try:
++    import tomli_w
++    TOMLI_W_AVAILABLE = True
++except ImportError:
++    # In environments where tomli_w is not available,
++    # we set it to None and mark as unavailable
++    tomli_w = None
++    TOMLI_W_AVAILABLE = False
++
+ import pytest
+-import tomli_w
+ 
+ from packaging.markers import Marker
+ from packaging.pylock import (
+@@ -41,7 +50,10 @@ else:
+ def test_pylock_file_name(file_name: str, valid: bool) -> None:
+     assert is_valid_pylock_path(Path(file_name)) is valid
+ 
+-
++@pytest.mark.skipif(
++    not TOMLI_W_AVAILABLE,
++    reason="tomli_w not available"
++)
+ def test_toml_roundtrip() -> None:
+     pep751_example = (
+         Path(__file__).parent / "pylock" / "pylock.spec-example.toml"
+-- 
+2.43.0
+
diff --git a/meta/recipes-devtools/python/python3-packaging_25.0.bb b/meta/recipes-devtools/python/python3-packaging_26.0.bb
similarity index 85%
rename from meta/recipes-devtools/python/python3-packaging_25.0.bb
rename to meta/recipes-devtools/python/python3-packaging_26.0.bb
index 9cb5c68f58..e683a0020c 100644
--- a/meta/recipes-devtools/python/python3-packaging_25.0.bb
+++ b/meta/recipes-devtools/python/python3-packaging_26.0.bb
@@ -3,9 +3,10 @@  HOMEPAGE = "https://github.com/pypa/packaging"
 LICENSE = "Apache-2.0 | BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=faadaedca9251a90b205c9167578ce91"
 
-SRC_URI[sha256sum] = "d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"
+SRC_URI[sha256sum] = "00243ae351a257117b6a241061796684b084ed1c516a08c48a3f7e147a9d80b4"
 
-SRC_URI += "file://run-ptest.in"
+SRC_URI += "file://run-ptest.in \
+            file://0001-tests-Handle-missing-tomli_w-gracefully-in-test_pylo.patch"
 
 inherit pypi python_flit_core ptest