Source: skimage
Version: 0.25.2-2
Severity: important
Tags: ftbfs patch
User: [email protected]
Usertags: python3.14

Hi Maintainer

skimage will FTBFS when Python 3.14 is added as a supported version,
see #1117927.  This transition is already underway in Ubuntu.  I've
copied what I hope is the relevant part of their log below.

The attached patch contains a fix for this issue cherry-picked from upstream.

Regards
Graham


=================================== FAILURES ===================================
________________ Test_deprecate_parameter.test_wrong_param_name ________________

self = <skimage._shared.tests.test_utils.Test_deprecate_parameter
object at 0x7ea5ae8fd550>

    def test_wrong_param_name(self):
        with pytest.raises(ValueError, match="'old' is not in list"):

>           @deprecate_parameter("old", start_version="0.10", 
> stop_version="0.12")
             
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

skimage/_shared/tests/test_utils.py:475:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <skimage._shared.utils.deprecate_parameter object at 0x7ea5a5b5ea50>
func = <function
Test_deprecate_parameter.test_wrong_param_name.<locals>.foo at
0x7ea59e83f7f0>

    def __call__(self, func):
        parameters = inspect.signature(func).parameters
>       deprecated_idx = list(parameters.keys()).index(self.deprecated_name)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       ValueError: list.index(x): x not in list

skimage/_shared/utils.py:255: ValueError

During handling of the above exception, another exception occurred:

self = <skimage._shared.tests.test_utils.Test_deprecate_parameter
object at 0x7ea5ae8fd550>

    def test_wrong_param_name(self):
>       with pytest.raises(ValueError, match="'old' is not in list"):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AssertionError: Regex pattern did not match.
E        Regex: "'old' is not in list"
E        Input: 'list.index(x): x not in list'

skimage/_shared/tests/test_utils.py:473: AssertionError
Description: fix test to match python 3.14
Origin: upstream, https://github.com/scikit-image/scikit-image/commit/61b32225cc75fc94d8b056dc6780cb1bf4cdcadf#diff-b18ac9fbca7548d3f9279dccca614307ec05194648515f467ac1e139b32adadd
Author: Grzegorz Bokota <[email protected]>
Last-Update: 2025-08-22

--- a/skimage/_shared/utils.py
+++ b/skimage/_shared/utils.py
@@ -252,11 +252,17 @@
 
     def __call__(self, func):
         parameters = inspect.signature(func).parameters
-        deprecated_idx = list(parameters.keys()).index(self.deprecated_name)
+        try:
+            deprecated_idx = list(parameters.keys()).index(self.deprecated_name)
+        except ValueError as e:
+            raise ValueError(f"{self.deprecated_name!r} not in parameters") from e
+
+        new_idx = False
         if self.new_name:
-            new_idx = list(parameters.keys()).index(self.new_name)
-        else:
-            new_idx = False
+            try:
+                new_idx = list(parameters.keys()).index(self.new_name)
+            except ValueError as e:
+                raise ValueError(f"{self.new_name!r} not in parameters") from e
 
         if parameters[self.deprecated_name].default is not DEPRECATED:
             raise RuntimeError(
@@ -520,8 +526,7 @@
 
     def __call__(self, func):
         message = (
-            f"`{func.__name__}` is deprecated since version "
-            f"{self.deprecated_version}"
+            f"`{func.__name__}` is deprecated since version {self.deprecated_version}"
         )
         if self.removed_version:
             message += f" and will be removed in version {self.removed_version}."
@@ -613,9 +618,7 @@
     try:
         np.testing.assert_allclose(mod, 0, atol=atol)
     except AssertionError:
-        raise ValueError(
-            f'Integer argument required but received ' f'{val}, check inputs.'
-        )
+        raise ValueError(f'Integer argument required but received {val}, check inputs.')
 
     return np.round(val).astype(np.int64)
 
@@ -776,7 +779,7 @@
         return 0 if image_dtype == bool else 1
 
     if order < 0 or order > 5:
-        raise ValueError("Spline interpolation order has to be in the " "range 0-5.")
+        raise ValueError("Spline interpolation order has to be in the range 0-5.")
 
     if image_dtype == bool and order != 0:
         raise ValueError(
--- a/skimage/_shared/tests/test_utils.py
+++ b/skimage/_shared/tests/test_utils.py
@@ -470,13 +470,13 @@
                 _func_deprecated_params(1, 2, old0=2)
 
     def test_wrong_param_name(self):
-        with pytest.raises(ValueError, match="'old' is not in list"):
+        with pytest.raises(ValueError, match="'old' not in parameters"):
 
             @deprecate_parameter("old", start_version="0.10", stop_version="0.12")
             def foo(arg0):
                 pass
 
-        with pytest.raises(ValueError, match="'new' is not in list"):
+        with pytest.raises(ValueError, match="'new' not in parameters"):
 
             @deprecate_parameter(
                 "old", new_name="new", start_version="0.10", stop_version="0.12"

Reply via email to