Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 2000

Show
Ignore:
Timestamp:
06/29/08 20:22:03
Author:
fumanchu
Message:

New --server and --client=<host> switches to individual tests. This allows you to run a test across a network in order to capture TCP traffic, compare platforms, etc.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/test/helper.py

    r1989 r2000  
    180180def testmain(conf=None): 
    181181    """Run __main__ as a test module, with webtest debugging.""" 
    182     if conf is None: 
    183         conf = {'server.socket_host': '127.0.0.1'} 
    184     setConfig(conf) 
    185     cherrypy.engine.start_with_callback(_test_main_thread) 
    186     cherrypy.engine.block() 
     182    if '--server' in sys.argv: 
     183        # Run the test module server-side only; wait for Ctrl-C to break. 
     184        if conf is None: 
     185            conf = {'server.socket_host': '0.0.0.0'} 
     186        setConfig(conf) 
     187        cherrypy.engine.start() 
     188        cherrypy.engine.block() 
     189    else: 
     190        for arg in sys.argv: 
     191            if arg.startswith('--client='): 
     192                # Run the test module client-side only. 
     193                sys.argv.remove(arg) 
     194                conf = conf or {} 
     195                conf['server.socket_host'] = host = arg.split('=', 1)[1].strip() 
     196                setConfig(conf) 
     197                webtest.WebCase.HOST = host 
     198                webtest.WebCase.PORT = cherrypy.server.socket_port 
     199                webtest.main() 
     200                break 
     201        else: 
     202            # Run normally (both server and client in same process). 
     203            if conf is None: 
     204                conf = {'server.socket_host': '127.0.0.1'} 
     205            setConfig(conf) 
     206            cherrypy.engine.start_with_callback(_test_main_thread) 
     207            cherrypy.engine.block() 
    187208 
    188209def _test_main_thread(): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets