diff --git a/param/_utils.py b/param/_utils.py index 4ca9b131..4fdc71c9 100644 --- a/param/_utils.py +++ b/param/_utils.py @@ -98,7 +98,7 @@ def inner(*args, **kwargs): f"Passing '{extra_args}' as positional argument(s) to 'param.{name}' " "has been deprecated since Param 2.0.0 and will raise an error in a future version, " "please pass them as keyword arguments.", - ParamPendingDeprecationWarning, + ParamDeprecationWarning, stacklevel=2, ) diff --git a/param/parameterized.py b/param/parameterized.py index c4c4d317..4af43111 100644 --- a/param/parameterized.py +++ b/param/parameterized.py @@ -4199,13 +4199,13 @@ def param(self): #PARAM3_DEPRECATION @property - @_deprecated(extra_msg="Use `inst.param.watchers` instead.", warning_cat=FutureWarning) + @_deprecated(extra_msg="Use `inst.param.watchers` instead.", warning_cat=_ParamFutureWarning) def _param_watchers(self): return self._param__private.watchers #PARAM3_DEPRECATION @_param_watchers.setter - @_deprecated(extra_msg="Use `inst.param.watchers = ...` instead.", warning_cat=FutureWarning) + @_deprecated(extra_msg="Use `inst.param.watchers = ...` instead.", warning_cat=_ParamFutureWarning) def _param_watchers(self, value): self._param__private.watchers = value diff --git a/tests/testdeprecations.py b/tests/testdeprecations.py index 6f755367..7303a1a8 100644 --- a/tests/testdeprecations.py +++ b/tests/testdeprecations.py @@ -22,7 +22,7 @@ def specific_filter(): class TestDeprecateParameter: def test_deprecate_posargs_Parameter(self): - with pytest.raises(param._utils.ParamPendingDeprecationWarning): + with pytest.raises(param._utils.ParamDeprecationWarning): param.Parameter(1, 'doc') def test_deprecate_List_class_(self): @@ -103,11 +103,11 @@ def test_deprecate_all_equal(self): param.parameterized.all_equal(1, 1) def test_deprecate_param_watchers(self): - with pytest.raises(FutureWarning): + with pytest.raises(param._utils.ParamFutureWarning): param.parameterized.Parameterized()._param_watchers def test_deprecate_param_watchers_setter(self): - with pytest.raises(FutureWarning): + with pytest.raises(param._utils.ParamFutureWarning): param.parameterized.Parameterized()._param_watchers = {} def test_param_error_unsafe_ops_before_initialized(self): diff --git a/tests/testsignatures.py b/tests/testsignatures.py index 1f66ae22..2f56ce8a 100644 --- a/tests/testsignatures.py +++ b/tests/testsignatures.py @@ -97,17 +97,17 @@ def test_signature_position_keywords(): def test_signature_warning_by_position(): # Simple test as it's tricky to automatically test all the Parameters with pytest.warns( - param._utils.ParamPendingDeprecationWarning, + param._utils.ParamDeprecationWarning, match=r"Passing 'objects' as positional argument\(s\) to 'param.Selector' has been deprecated since Param 2.0.0 and will raise an error in a future version, please pass them as keyword arguments" ): param.Selector([0, 1]) # objects with pytest.warns( - param._utils.ParamPendingDeprecationWarning, + param._utils.ParamDeprecationWarning, match=r"Passing 'class_' as positional argument\(s\) to 'param.ClassSelector' has been deprecated since Param 2.0.0 and will raise an error in a future version, please pass them as keyword arguments" ): param.ClassSelector(int) # class_ with pytest.warns( - param._utils.ParamPendingDeprecationWarning, + param._utils.ParamDeprecationWarning, match=r"Passing 'bounds, softbounds' as positional argument\(s\) to 'param.Number' has been deprecated since Param 2.0.0 and will raise an error in a future version, please pass them as keyword arguments" ): param.Number(1, (0, 2), (0, 2)) # default (OK), bounds (not OK), softbounds (not OK) diff --git a/tests/testwatch.py b/tests/testwatch.py index 9bf1309b..61d76617 100644 --- a/tests/testwatch.py +++ b/tests/testwatch.py @@ -652,7 +652,7 @@ def test_watch_watchers_exposed(self): obj.param.watch(lambda: '', ['a', 'b']) - with pytest.warns(FutureWarning): + with pytest.warns(param._utils.ParamFutureWarning): pw = obj._param_watchers assert isinstance(pw, dict) for pname in ('a', 'b'): @@ -667,7 +667,7 @@ def test_watch_watchers_modified(self): obj.param.watch(accumulator, ['a', 'b']) - with pytest.warns(FutureWarning): + with pytest.warns(param._utils.ParamFutureWarning): pw = obj._param_watchers del pw['a']