~ubuntu-branches/ubuntu/trusty/python-webob/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/performance_test.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-01-07 07:52:32 UTC
  • mfrom: (1.3.5)
  • Revision ID: package-import@ubuntu.com-20130107075232-w6x8r94du3t48wj4
Tags: 1.2.3-0ubuntu1
* New upstream release:
  - Dropped debian/patches/01_lp_920197.patch: no longer needed.
  - debian/watch: Update to point to pypi.
  - debian/rules: Disable docs build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
 
import webob
 
2
from webob.response import Response
3
3
 
4
4
def make_middleware(app):
5
5
    from repoze.profile.profiler import AccumulatingProfileMiddleware
11
11
        path='/__profile__')
12
12
 
13
13
def simple_app(environ, start_response):
14
 
    resp = webob.Response('Hello world!')
 
14
    resp = Response('Hello world!')
15
15
    return resp(environ, start_response)
16
16
 
17
17
if __name__ == '__main__':
32
32
        subprocess.call(['ab', '-n', '1000', 'http://localhost:8080/'])
33
33
        if arg == 'open':
34
34
            webbrowser.open('http://localhost:8080/__profile__')
35
 
        print 'Hit ^C to end'
 
35
        print('Hit ^C to end')
36
36
        try:
37
37
            while 1:
38
38
                raw_input()
41
41
    else:
42
42
        from paste.httpserver import serve
43
43
        if os.environ.get('SHOW_OUTPUT') != '0':
44
 
            print 'Note you can also use:'
45
 
            print '  %s %s open' % (sys.executable, __file__)
46
 
            print 'to run ab and open a browser (or "run" to just run ab)'
47
 
            print 'Now do:'
48
 
            print 'ab -n 1000 http://localhost:8080/'
49
 
            print 'wget -O - http://localhost:8080/__profile__'
 
44
            print('Note you can also use:)')
 
45
            print('  %s %s open' % (sys.executable, __file__))
 
46
            print('to run ab and open a browser (or "run" to just run ab)')
 
47
            print('Now do:')
 
48
            print('ab -n 1000 http://localhost:8080/')
 
49
            print('wget -O - http://localhost:8080/__profile__')
50
50
        serve(make_middleware(simple_app))