##// END OF EJS Templates
Backport PR #10039: Improve deprecation warnings...
Thomas Kluyver -
Show More
@@ -64,7 +64,7 b' def BdbQuit_excepthook(et, ev, tb, excepthook=None):'
64 64 parameter.
65 65 """
66 66 warnings.warn("`BdbQuit_excepthook` is deprecated since version 5.1",
67 DeprecationWarning)
67 DeprecationWarning, stacklevel=2)
68 68 if et==bdb.BdbQuit:
69 69 print('Exiting Debugger.')
70 70 elif excepthook is not None:
@@ -77,7 +77,7 b' def BdbQuit_excepthook(et, ev, tb, excepthook=None):'
77 77 def BdbQuit_IPython_excepthook(self,et,ev,tb,tb_offset=None):
78 78 warnings.warn(
79 79 "`BdbQuit_IPython_excepthook` is deprecated since version 5.1",
80 DeprecationWarning)
80 DeprecationWarning, stacklevel=2)
81 81 print('Exiting Debugger.')
82 82
83 83
@@ -129,7 +129,7 b' class Tracer(object):'
129 129 """
130 130 warnings.warn("`Tracer` is deprecated since version 5.1, directly use "
131 131 "`IPython.core.debugger.Pdb.set_trace()`",
132 DeprecationWarning)
132 DeprecationWarning, stacklevel=2)
133 133
134 134 ip = get_ipython()
135 135 if ip is None:
@@ -165,7 +165,8 b' class Deprec(object):'
165 165
166 166 def __getattr__(self, name):
167 167 val = getattr(self.wrapped, name)
168 warnings.warn("Using ExceptionColors global is deprecated and will be removed in IPython 6.0", DeprecationWarning)
168 warnings.warn("Using ExceptionColors global is deprecated and will be removed in IPython 6.0",
169 DeprecationWarning, stacklevel=2)
169 170 # using getattr after warnings break ipydoctest in weird way for 3.5
170 171 return val
171 172
@@ -658,7 +658,9 b' guis = inputhook_manager.guihooks'
658 658
659 659
660 660 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)
662 663 inputhook_manager.disable_gui()
664
663 665 disable_wx = disable_qt4 = disable_gtk = disable_gtk3 = disable_glut = \
664 666 disable_pyglet = disable_osx = _deprecated_disable
@@ -67,7 +67,7 b' def as_unittest(func):'
67 67
68 68 # Utility functions
69 69
70 def apply_wrapper(wrapper,func):
70 def apply_wrapper(wrapper, func):
71 71 """Apply a wrapper to a function for decoration.
72 72
73 73 This mixes Michele Simionato's decorator tool with nose's make_decorator,
@@ -76,14 +76,14 b' def apply_wrapper(wrapper,func):'
76 76 This will ensure that wrapped functions can still be well introspected via
77 77 IPython, for example.
78 78 """
79 warnings.warn("The function `apply_wrapper` is deprecated and might be removed in IPython 5.0", DeprecationWarning)
80
79 warnings.warn("The function `apply_wrapper` is deprecated since IPython 4.0",
80 DeprecationWarning, stacklevel=2)
81 81 import nose.tools
82 82
83 83 return decorator(wrapper,nose.tools.make_decorator(func)(wrapper))
84 84
85 85
86 def make_label_dec(label,ds=None):
86 def make_label_dec(label, ds=None):
87 87 """Factory function to create a decorator that applies one or more labels.
88 88
89 89 Parameters
@@ -128,7 +128,8 b' def make_label_dec(label,ds=None):'
128 128 True
129 129 """
130 130
131 warnings.warn("The function `make_label_dec` is deprecated and might be removed in IPython 5.0", DeprecationWarning)
131 warnings.warn("The function `make_label_dec` is deprecated since IPython 4.0",
132 DeprecationWarning, stacklevel=2)
132 133 if isinstance(label, string_types):
133 134 labels = [label]
134 135 else:
@@ -284,7 +285,8 b' def decorated_dummy(dec, name):'
284 285 import IPython.testing.decorators as dec
285 286 setup = dec.decorated_dummy(dec.skip_if_no_x11, __name__)
286 287 """
287 warnings.warn("The function `make_label_dec` is deprecated and might be removed in IPython 5.0", DeprecationWarning)
288 warnings.warn("The function `decorated_dummy` is deprecated since IPython 4.0",
289 DeprecationWarning, stacklevel=2)
288 290 dummy = lambda: None
289 291 dummy.__name__ = name
290 292 return dec(dummy)
@@ -317,7 +319,8 b' skip_if_no_x11 = skipif(_x11_skip_cond, _x11_skip_msg)'
317 319
318 320 # not a decorator itself, returns a dummy function to be used as setup
319 321 def skip_file_no_x11(name):
320 warnings.warn("The function `skip_file_no_x11` is deprecated and might be removed in IPython 5.0", DeprecationWarning)
322 warnings.warn("The function `skip_file_no_x11` is deprecated since IPython 4.0",
323 DeprecationWarning, stacklevel=2)
321 324 return decorated_dummy(skip_if_no_x11, name) if _x11_skip_cond else None
322 325
323 326 # Other skip decorators
@@ -372,7 +375,8 b' def onlyif_any_cmd_exists(*commands):'
372 375 """
373 376 Decorator to skip test unless at least one of `commands` is found.
374 377 """
375 warnings.warn("The function `onlyif_any_cmd_exists` is deprecated and might be removed in IPython 5.0", DeprecationWarning)
378 warnings.warn("The function `onlyif_any_cmd_exists` is deprecated since IPython 4.0",
379 DeprecationWarning, stacklevel=2)
376 380 for cmd in commands:
377 381 if which(cmd):
378 382 return null_deco
@@ -50,6 +50,16 b' if sys.version_info > (3,0):'
50 50 warnings.filterwarnings('error', message=".*{'config': True}.*", category=DeprecationWarning, module='IPy.*')
51 51 warnings.filterwarnings('default', message='.*', category=Warning, module='IPy.*')
52 52
53 warnings.filterwarnings('error', message='.*apply_wrapper.*', category=DeprecationWarning, module='.*')
54 warnings.filterwarnings('error', message='.*make_label_dec', category=DeprecationWarning, module='.*')
55 warnings.filterwarnings('error', message='.*decorated_dummy.*', category=DeprecationWarning, module='.*')
56 warnings.filterwarnings('error', message='.*skip_file_no_x11.*', category=DeprecationWarning, module='.*')
57 warnings.filterwarnings('error', message='.*onlyif_any_cmd_exists.*', category=DeprecationWarning, module='.*')
58
59 warnings.filterwarnings('error', message='.*disable_gui.*', category=DeprecationWarning, module='.*')
60
61 warnings.filterwarnings('error', message='.*ExceptionColors global is deprecated.*', category=DeprecationWarning, module='.*')
62
53 63 if version_info < (6,):
54 64 # nose.tools renames all things from `camelCase` to `snake_case` which raise an
55 65 # warning with the runner they also import from standard import library. (as of Dec 2015)
General Comments 0
You need to be logged in to leave comments. Login now