The reverse from skipif, see skipif for details.
(condition, msg)
| 252 | |
| 253 | |
| 254 | def onlyif(condition, msg): |
| 255 | """The reverse from skipif, see skipif for details.""" |
| 256 | |
| 257 | if callable(condition): |
| 258 | skip_condition = lambda : not condition() |
| 259 | else: |
| 260 | skip_condition = lambda : not condition |
| 261 | |
| 262 | return skipif(skip_condition, msg) |
| 263 | |
| 264 | #----------------------------------------------------------------------------- |
| 265 | # Utility functions for decorators |