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