def requires_mac_ver(*min_version):
 def decorator(func):
  @functools.wraps(func)
  def wrapper(*args, **kw):
   if (sys.platform == 'darwin'):
    version_txt = platform.mac_ver()[0]
    try:
     version = tuple(map(int, version_txt.split('.')))
    except ValueError:
     pass
    else:
     if (version < min_version):
      min_version_txt = '.'.join(map(str, min_version))
      raise unittest.SkipTest(('Mac OS X %s or higher required, not %s' % (min_version_txt, version_txt)))
   return func(*args, **kw)
  wrapper.min_version = min_version
  return wrapper
 return decorator

def requires_mac_ver ( * min_version ) : def decorator ( func ) : @ functools . wraps ( func ) def wrapper ( * args , ** kw ) : if ( sys . platform == 'darwin' ) : version_txt = platform . mac_ver ( ) [ 0 ] try : version = tuple ( map ( int , version_txt . split ( '.' ) ) ) except ValueError : pass else : if ( version < min_version ) : min_version_txt = '.' . join ( map ( str , min_version ) ) raise unittest . SkipTest ( ( 'Mac OS X %s or higher required, not %s' % ( min_version_txt , version_txt ) ) ) return func ( * args , ** kw ) wrapper . min_version = min_version return wrapper return decorator
decorator raising skiptest if the os is mac os x and the os x version if less than min_version .