summaryrefslogtreecommitdiff
path: root/cherrypy/test/benchmark.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2018-05-11 12:57:02 -0400
committerJason R. Coombs <jaraco@jaraco.com>2018-05-11 12:58:21 -0400
commitd9cdbc0ff5a0c46f811a37aed97111edacbce818 (patch)
tree78ba8882a27c1e16df6c64e338495e68423f27df /cherrypy/test/benchmark.py
parent36e94558a8276cc9324a6167ebc911c677bc0942 (diff)
downloadcherrypy-git-d9cdbc0ff5a0c46f811a37aed97111edacbce818.tar.gz
Initialize in a function so it's not invoked on import
Diffstat (limited to 'cherrypy/test/benchmark.py')
-rw-r--r--cherrypy/test/benchmark.py50
1 files changed, 28 insertions, 22 deletions
diff --git a/cherrypy/test/benchmark.py b/cherrypy/test/benchmark.py
index 6f0f37f7..44dfeff1 100644
--- a/cherrypy/test/benchmark.py
+++ b/cherrypy/test/benchmark.py
@@ -77,28 +77,32 @@ class Root:
return resp
-cherrypy.config.update({
- 'log.error.file': '',
- 'environment': 'production',
- 'server.socket_host': '127.0.0.1',
- 'server.socket_port': 54583,
- 'server.max_request_header_size': 0,
- 'server.max_request_body_size': 0,
-})
-
-# Cheat mode on ;)
-del cherrypy.config['tools.log_tracebacks.on']
-del cherrypy.config['tools.log_headers.on']
-del cherrypy.config['tools.trailing_slash.on']
-
-appconf = {
- '/static': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': 'static',
- 'tools.staticdir.root': curdir,
- },
-}
-app = cherrypy.tree.mount(Root(), SCRIPT_NAME, appconf)
+def init():
+
+ cherrypy.config.update({
+ 'log.error.file': '',
+ 'environment': 'production',
+ 'server.socket_host': '127.0.0.1',
+ 'server.socket_port': 54583,
+ 'server.max_request_header_size': 0,
+ 'server.max_request_body_size': 0,
+ })
+
+ # Cheat mode on ;)
+ del cherrypy.config['tools.log_tracebacks.on']
+ del cherrypy.config['tools.log_headers.on']
+ del cherrypy.config['tools.trailing_slash.on']
+
+ appconf = {
+ '/static': {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': 'static',
+ 'tools.staticdir.root': curdir,
+ },
+ }
+ globals().update(
+ app=cherrypy.tree.mount(Root(), SCRIPT_NAME, appconf),
+ )
class NullRequest:
@@ -353,6 +357,8 @@ def run_modpython(use_wsgi=False):
if __name__ == '__main__':
+ init()
+
longopts = ['cpmodpy', 'modpython', 'null', 'notests',
'help', 'ab=', 'apache=']
try: