def skip_if_no(package, min_version=None):
def decorated_func(func):<EOL><INDENT>msg = "<STR_LIT>".format(package)<EOL>if min_version:<EOL><INDENT>msg += "<STR_LIT>".format(min_version)<EOL><DEDENT>return pytest.mark.skipif(<EOL>not safe_import(package, min_version=min_version), reason=msg<EOL>)(func)<EOL><DEDENT>return decorated_func<EOL>
Generic function to help skip test functions when required packages are not
present on the testing system.

Intended for use as a decorator, this function will wrap the decorated
function with a pytest ``skip_if`` mark. During a pytest test suite
execution, that mark will attempt to import the specified ``package`` and
optionally ensure it meets the ``min_version``. If the import and version
check are unsuccessful, then the decorated function will be skipped.

Parameters
----------
package: str
    The name of the package required by the decorated function
min_version: str or None, default None
    Optional minimum version of the package required by the decorated
    function

Returns
-------
decorated_func: function
    The decorated function wrapped within a pytest ``skip_if`` mark