From a96dd9e4724f4c425a14257e0f592a1f79a1ff0e 2022-02-08 11:10:55 From: Matthias Bussonnier Date: 2022-02-08 11:10:55 Subject: [PATCH] MAINT: deprecate append_to_syspath --- diff --git a/IPython/utils/syspathcontext.py b/IPython/utils/syspathcontext.py index bd1c515..7af1ab6 100644 --- a/IPython/utils/syspathcontext.py +++ b/IPython/utils/syspathcontext.py @@ -15,12 +15,21 @@ Authors: #----------------------------------------------------------------------------- import sys +import warnings class appended_to_syspath(object): - """A context for appending a directory to sys.path for a second.""" + """ + Deprecated since IPython 8.1, no replacements. + + A context for appending a directory to sys.path for a second.""" def __init__(self, dir): + warnings.warn( + "`appended_to_syspath` is deprecated since IPython 8.1, and has no replacements", + DeprecationWarning, + stacklevel=2, + ) self.dir = dir def __enter__(self): diff --git a/IPython/utils/tests/test_deprecated.py b/IPython/utils/tests/test_deprecated.py new file mode 100644 index 0000000..f6f54ce --- /dev/null +++ b/IPython/utils/tests/test_deprecated.py @@ -0,0 +1,7 @@ +from IPython.utils.syspathcontext import appended_to_syspath +import pytest + + +def test_append_deprecated(): + with pytest.warns(DeprecationWarning): + appended_to_syspath(".") diff --git a/IPython/utils/version.py b/IPython/utils/version.py index 0501556..8c65c78 100644 --- a/IPython/utils/version.py +++ b/IPython/utils/version.py @@ -14,7 +14,10 @@ It is a bit ridiculous that we need these. from warnings import warn -warn("The `IPython.utils.version` module has been deprecated since IPython 8.0.") +warn( + "The `IPython.utils.version` module has been deprecated since IPython 8.0.", + DeprecationWarning, +) def check_version(v, check):