Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3628f16

Browse files
committed
Add stacklevel to deprecation warning and filter accordingly
1 parent 1d0295e commit 3628f16

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

IPython/lib/inputhook.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,9 @@ def enable(self, app=None):
658658

659659

660660
def _deprecated_disable():
661-
warn("This function is deprecated since IPython 4.0 use disable_gui() instead", DeprecationWarning)
661+
warn("This function is deprecated since IPython 4.0 use disable_gui() instead",
662+
DeprecationWarning, stacklevel=2)
662663
inputhook_manager.disable_gui()
664+
663665
disable_wx = disable_qt4 = disable_gtk = disable_gtk3 = disable_glut = \
664666
disable_pyglet = disable_osx = _deprecated_disable

IPython/testing/iptest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
warnings.filterwarnings('error', message='.*decorated_dummy.*', category=DeprecationWarning, module='.*')
5454
warnings.filterwarnings('error', message='.*skip_file_no_x11.*', category=DeprecationWarning, module='.*')
5555
warnings.filterwarnings('error', message='.*onlyif_any_cmd_exists.*', category=DeprecationWarning, module='.*')
56+
57+
warnings.filterwarnings('error', message='.*disable_gui.*', category=DeprecationWarning, module='.*')
58+
5659
if version_info < (6,):
5760
# nose.tools renames all things from `camelCase` to `snake_case` which raise an
5861
# warning with the runner they also import from standard import library. (as of Dec 2015)

0 commit comments

Comments
 (0)