Changeset 10107 in genesis


Ignore:
Timestamp:
Mar 11, 2012, 11:34:49 AM (13 years ago)
Author:
rick
Message:

Unit testing to find out whether some output yield and critical error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r10106 r10107  
    826826
    827827def is_text_request():
    828   return os.environ['HTTP_USER_AGENT'].split()[0] in ['curl', 'fetch', 'wget']
     828  """ Find out whether we are calling from the CLI or any text based CLI utility """
     829  try:
     830    return os.environ['HTTP_USER_AGENT'].split()[0] in ['curl', 'fetch', 'wget']
     831  except KeyError:
     832    return True
    829833
    830834def main():
     
    870874      os.environ['SCRIPT_NAME'] = __file__
    871875      process_cgi_request()
     876    elif sys.argv[1] == "unit-test":
     877      os.environ['SCRIPT_NAME'] = __file__
     878      for host in get_hostlist():
     879        for outfile in files:
     880          os.environ['PATH_INFO'] = "/".join([host,outfile])
     881          try:
     882            process_cgi_request()
     883          except Exception:
     884            print "# ERROR: %s" % os.environ['PATH_INFO']
     885            raise
     886           
     887           
    872888    elif sys.argv[1] == "static":
    873889      items = dict()
Note: See TracChangeset for help on using the changeset viewer.