##// END OF EJS Templates
Add stacklevel to a few deprecation warnings
Matthias Bussonnier -
Show More
@@ -68,7 +68,7 b' def as_unittest(func):'
68 68
69 69 # Utility functions
70 70
71 def apply_wrapper(wrapper,func):
71 def apply_wrapper(wrapper, func):
72 72 """Apply a wrapper to a function for decoration.
73 73
74 74 This mixes Michele Simionato's decorator tool with nose's make_decorator,
@@ -77,14 +77,14 b' def apply_wrapper(wrapper,func):'
77 77 This will ensure that wrapped functions can still be well introspected via
78 78 IPython, for example.
79 79 """
80 warnings.warn("The function `apply_wrapper` is deprecated and might be removed in IPython 5.0", DeprecationWarning)
81
80 warnings.warn("The function `apply_wrapper` is deprecated and might be removed in IPython 5.0",
81 DeprecationWarning, stacklevel=2)
82 82 import nose.tools
83 83
84 84 return decorator(wrapper,nose.tools.make_decorator(func)(wrapper))
85 85
86 86
87 def make_label_dec(label,ds=None):
87 def make_label_dec(label, ds=None):
88 88 """Factory function to create a decorator that applies one or more labels.
89 89
90 90 Parameters
@@ -129,7 +129,8 b' def make_label_dec(label,ds=None):'
129 129 True
130 130 """
131 131
132 warnings.warn("The function `make_label_dec` is deprecated and might be removed in IPython 5.0", DeprecationWarning)
132 warnings.warn("The function `make_label_dec` is deprecated and might be removed in IPython 5.0",
133 DeprecationWarning, stacklevel=2)
133 134 if isinstance(label, string_types):
134 135 labels = [label]
135 136 else:
@@ -285,7 +286,8 b' def decorated_dummy(dec, name):'
285 286 import IPython.testing.decorators as dec
286 287 setup = dec.decorated_dummy(dec.skip_if_no_x11, __name__)
287 288 """
288 warnings.warn("The function `make_label_dec` is deprecated and might be removed in IPython 5.0", DeprecationWarning)
289 warnings.warn("The function `decorated_dummy` is deprecated and might be removed in IPython 5.0",
290 DeprecationWarning, stacklevel=2)
289 291 dummy = lambda: None
290 292 dummy.__name__ = name
291 293 return dec(dummy)
@@ -318,7 +320,8 b' skip_if_no_x11 = skipif(_x11_skip_cond, _x11_skip_msg)'
318 320
319 321 # not a decorator itself, returns a dummy function to be used as setup
320 322 def skip_file_no_x11(name):
321 warnings.warn("The function `skip_file_no_x11` is deprecated and might be removed in IPython 5.0", DeprecationWarning)
323 warnings.warn("The function `skip_file_no_x11` is deprecated and might be removed in IPython 5.0",
324 DeprecationWarning, stacklevel=2)
322 325 return decorated_dummy(skip_if_no_x11, name) if _x11_skip_cond else None
323 326
324 327 # Other skip decorators
@@ -366,7 +369,8 b' def onlyif_any_cmd_exists(*commands):'
366 369 """
367 370 Decorator to skip test unless at least one of `commands` is found.
368 371 """
369 warnings.warn("The function `onlyif_any_cmd_exists` is deprecated and might be removed in IPython 5.0", DeprecationWarning)
372 warnings.warn("The function `onlyif_any_cmd_exists` is deprecated and might be removed in IPython 5.0",
373 DeprecationWarning, stacklevel=2)
370 374 for cmd in commands:
371 375 if which(cmd):
372 376 return null_deco
General Comments 0
You need to be logged in to leave comments. Login now