| 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() |
|---|