<filename>mvlearn/utils/_testing.py
from functools import partial


def requires_module(function, name, call=None):
    """Skip a test if package is not available (decorator)."""
    import pytest

    call = ("import %s" % name) if call is None else call
    reason = "Test %s skipped, requires %s." % (function.__name__, name)
    try:
        exec(call) in globals(), locals()
    except Exception as exc:
        if len(str(exc)) > 0 and str(exc) != "No module named %s" % name:
            reason += " Got exception (%s)" % (exc,)
        skip = True
    else:
        skip = False
    return pytest.mark.skipif(skip, reason=reason)(function)


requires_multiviewica = partial(requires_module, name="multiviewica")

<filename>mvlearn/utils/_testing.py
from functools import partial


def requires_module(function, name, call=None):
    """Skip a test if package is not available (decorator)."""
    import pytest

    call = ("import %s" % name) if call is None else call
    reason = "Test %s skipped, requires %s." % (function.__name__, name)
    try:
        exec(call) in globals(), locals()
    except Exception as exc:
        if len(str(exc)) > 0 and str(exc) != "No module named %s" % name:
            reason += " Got exception (%s)" % (exc,)
        skip = True
    else:
        skip = False
    return pytest.mark.skipif(skip, reason=reason)(function)


requires_multiviewica = partial(requires_module, name="multiviewica")

Skip a test if package is not available (decorator).