From 3628f16a373cdf4243e21f2785f4872abc80154e 2016-10-28 03:07:46 From: Matthias Bussonnier Date: 2016-10-28 03:07:46 Subject: [PATCH] Add stacklevel to deprecation warning and filter accordingly --- diff --git a/IPython/lib/inputhook.py b/IPython/lib/inputhook.py index 98d8c2c..e6e8f2d 100644 --- a/IPython/lib/inputhook.py +++ b/IPython/lib/inputhook.py @@ -658,7 +658,9 @@ guis = inputhook_manager.guihooks def _deprecated_disable(): - warn("This function is deprecated since IPython 4.0 use disable_gui() instead", DeprecationWarning) + warn("This function is deprecated since IPython 4.0 use disable_gui() instead", + DeprecationWarning, stacklevel=2) inputhook_manager.disable_gui() + disable_wx = disable_qt4 = disable_gtk = disable_gtk3 = disable_glut = \ disable_pyglet = disable_osx = _deprecated_disable diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 54e7d64..f0561c7 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -53,6 +53,9 @@ warnings.filterwarnings('error', message='.*make_label_dec', category=Deprecatio warnings.filterwarnings('error', message='.*decorated_dummy.*', category=DeprecationWarning, module='.*') warnings.filterwarnings('error', message='.*skip_file_no_x11.*', category=DeprecationWarning, module='.*') warnings.filterwarnings('error', message='.*onlyif_any_cmd_exists.*', category=DeprecationWarning, module='.*') + +warnings.filterwarnings('error', message='.*disable_gui.*', category=DeprecationWarning, module='.*') + if version_info < (6,): # nose.tools renames all things from `camelCase` to `snake_case` which raise an # warning with the runner they also import from standard import library. (as of Dec 2015)