(condition, skip_message)
return decorator
A decorator factory for sipping benchmarks conditionally.

    Parameters
    ----------
    condition : bool or function
        A boolean value or a lambda callback to determine
        whether the benchmark should be skipped.
    skip_message : str
        The message to display if the bench is skipped.

    Returns
    -------
    function
        The custom skip decorator.
A decorator factory for sipping benchmarks conditionally.
A decorator factory for sipping benchmarks conditionally .
def _bench_skipper(condition, skip_message):
    """A decorator factory for sipping benchmarks conditionally.

    Parameters
    ----------
    condition : bool or function
        A boolean value or a lambda callback to determine
        whether the benchmark should be skipped.
    skip_message : str
        The message to display if the bench is skipped.

    Returns
    -------
    function
        The custom skip decorator.
    """
    def decorator(func):
        if (isinstance(condition, bool) and condition) or \
                (not isinstance(condition, bool) and condition()):
            # display a message and skip bench
            wrapper = unittest.skip("[{}] skipped: {}\n".format(_get_bench_name(func), skip_message))(func)
        else:
            # allow execution
            @wraps(func)
            def wrapper(*args, **kwargs):
                func(*args, **kwargs)
        return wrapper
    return decorator
def _bench_skipper ( condition , skip_message ) : def decorator ( func ) : if ( isinstance ( condition , bool ) and condition ) or ( not isinstance ( condition , bool ) and condition ( ) ) : # display a message and skip bench wrapper = unittest . skip ( "[{}] skipped: {}\n" . format ( _get_bench_name ( func ) , skip_message ) ) ( func ) else : # allow execution @ wraps ( func ) def wrapper ( * args , * * kwargs ) : func ( * args , * * kwargs ) return wrapper return decorator