From 24314829e46a9fd6026623be07dcbe95395e5de2 2019-06-18 18:07:22 From: Matthias Bussonnier Date: 2019-06-18 18:07:22 Subject: [PATCH] Fix skip decorator. If called w/o argument would just skip the function always. Now raises if no message is passed. --- diff --git a/IPython/testing/decorators.py b/IPython/testing/decorators.py index fff6221..91e7193 100644 --- a/IPython/testing/decorators.py +++ b/IPython/testing/decorators.py @@ -245,8 +245,10 @@ def skip(msg=None): Decorator, which, when applied to a function, causes SkipTest to be raised, with the optional message added. """ - - return skipif(True,msg) + if msg and not isinstance(msg, str): + raise ValueError('invalid object passed to `@skip` decorator, did you ' + 'meant `@skip()` with brackets ?') + return skipif(True, msg) def onlyif(condition, msg): diff --git a/IPython/testing/tests/test_decorators.py b/IPython/testing/tests/test_decorators.py index ef34625..dc1ff41 100644 --- a/IPython/testing/tests/test_decorators.py +++ b/IPython/testing/tests/test_decorators.py @@ -46,7 +46,7 @@ def trivial(): pass -@dec.skip +@dec.skip() def test_deliberately_broken(): """A deliberately broken test - we want to skip this one.""" 1/0