##// END OF EJS Templates
Add new @onlyif decorator, the reverse of @skipif....
Fernando Perez -
Show More
@@ -205,7 +205,7 b' def skipif(skip_condition, msg=None):'
205
205
206 # Allow for both boolean or callable skip conditions.
206 # Allow for both boolean or callable skip conditions.
207 if callable(skip_condition):
207 if callable(skip_condition):
208 skip_val = lambda : skip_condition()
208 skip_val = skip_condition
209 else:
209 else:
210 skip_val = lambda : skip_condition
210 skip_val = lambda : skip_condition
211
211
@@ -262,6 +262,16 b' def skip(msg=None):'
262 return skipif(True,msg)
262 return skipif(True,msg)
263
263
264
264
265 def onlyif(condition, msg):
266 """The reverse from skipif, see skipif for details."""
267
268 if callable(condition):
269 skip_condition = lambda : not condition()
270 else:
271 skip_condition = lambda : not condition
272
273 return skipif(skip_condition, msg)
274
265 #-----------------------------------------------------------------------------
275 #-----------------------------------------------------------------------------
266 # Utility functions for decorators
276 # Utility functions for decorators
267 def numpy_not_available():
277 def numpy_not_available():
General Comments 0
You need to be logged in to leave comments. Login now