def requires_no_pygments_exceptions(fn): def go(*arg, **kw): from mako import exceptions exceptions._install_fallback() try: return fn(*arg, **kw) finally: exceptions._install_highlighting() return update_wrapper(go, fn)
def decorate(fn): fn_name = fn.__name__ def maybe(*args, **kw): if predicate(): msg = "'%s' skipped: %s" % ( fn_name, reason) raise SkipTest(msg) else: return fn(*args, **kw) return update_wrapper(maybe, fn)