code: def requires_module(function, name, call=None):
      """Skip a test if package is not available (decorator)."""
      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)
  
file_path: pyRiemann/tests/conftest.py
imports: import pytest
  import numpy
  from functools import partial
  from pyriemann.datasets import make_matrices, make_masks
label_desc: Use image node_id 1 for calling a global function with example usage: requires_module(function, name, call) and returns: pytest