def skip_if_not_available(modules=None, datasets=None, configurations=None):
 if (modules is None):
  modules = []
 if (datasets is None):
  datasets = []
 if (configurations is None):
  configurations = []
 for module in modules:
  try:
   import_module(module)
  except Exception:
   raise SkipTest
  if (module == 'bokeh'):
   ConnectionError = import_module('requests.exceptions').ConnectionError
   session = import_module('bokeh.session').Session()
   try:
    session.execute('get', session.base_url)
   except ConnectionError:
    raise SkipTest
 if (datasets and (not hasattr(config, 'data_path'))):
  raise SkipTest
 for dataset in datasets:
  if (not os.path.exists(os.path.join(config.data_path, dataset))):
   raise SkipTest
 for configuration in configurations:
  if (not hasattr(config, configuration)):
   raise SkipTest

def skip_if_not_available ( modules = None , datasets = None , configurations = None ) : if ( modules is None ) : modules = [ ] if ( datasets is None ) : datasets = [ ] if ( configurations is None ) : configurations = [ ] for module in modules : try : import_module ( module ) except Exception : raise SkipTest if ( module == 'bokeh' ) : ConnectionError = import_module ( 'requests.exceptions' ) . ConnectionError session = import_module ( 'bokeh.session' ) . Session ( ) try : session . execute ( 'get' , session . base_url ) except ConnectionError : raise SkipTest if ( datasets and ( not hasattr ( config , 'data_path' ) ) ) : raise SkipTest for dataset in datasets : if ( not os . path . exists ( os . path . join ( config . data_path , dataset ) ) ) : raise SkipTest for configuration in configurations : if ( not hasattr ( config , configuration ) ) : raise SkipTest
raises a skiptest exception when requirements are not met .