def requireSocket(*args):
 err = None
 missing = [obj for obj in args if (isinstance(obj, str) and (not hasattr(socket, obj)))]
 if missing:
  err = ("don't have " + ', '.join((name for name in missing)))
 else:
  callargs = [(getattr(socket, obj) if isinstance(obj, str) else obj) for obj in args]
  try:
   s = socket.socket(*callargs)
  except OSError as e:
   err = str(e)
  else:
   s.close()
 return skipWithClientIf((err is not None), "can't create socket({0}): {1}".format(', '.join((str(o) for o in args)), err))

def requireSocket ( * args ) : err = None missing = [ obj for obj in args if ( isinstance ( obj , str ) and ( not hasattr ( socket , obj ) ) ) ] if missing : err = ( "don't have " + ', ' . join ( ( name for name in missing ) ) ) else : callargs = [ ( getattr ( socket , obj ) if isinstance ( obj , str ) else obj ) for obj in args ] try : s = socket . socket ( * callargs ) except OSError as e : err = str ( e ) else : s . close ( ) return skipWithClientIf ( ( err is not None ) , "can't create socket({0}): {1}" . format ( ', ' . join ( ( str ( o ) for o in args ) ) , err ) )
skip decorated test if a socket cannot be created with given arguments .