Skip to content

Commit

Permalink
finally, passes all the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
puzzlet committed Sep 1, 2012
1 parent fe65f4c commit c1401e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 1 addition & 2 deletions werkzeug/testapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ def render_testapp(req):
eggs = ()
else:
eggs = list(pkg_resources.working_set)
eggs.sort(lambda a, b: cmp(a.project_name.lower(),
b.project_name.lower()))
eggs.sort(key=lambda a: a.project_name.lower())
python_eggs = []
for egg in eggs:
try:
Expand Down
13 changes: 8 additions & 5 deletions werkzeug/testsuite/serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,20 @@ class ServingTestCase(WerkzeugTestCase):
def test_serving(self):
server, addr = run_dev_server(test_app)
rv = urllib.request.urlopen('http://%s/?foo=bar&baz=blah' % addr).read()
assert 'WSGI Information' in rv
assert 'foo=bar&baz=blah' in rv
assert ('Werkzeug/%s' % version) in rv
assert b'WSGI Information' in rv
assert b'foo=bar&baz=blah' in rv
assert ('Werkzeug/%s' % version).encode('ascii') in rv

@silencestderr
def test_broken_app(self):
def broken_app(environ, start_response):
1/0
server, addr = run_dev_server(broken_app)
rv = urllib.request.urlopen('http://%s/?foo=bar&baz=blah' % addr).read()
assert 'Internal Server Error' in rv
# XXX: urlopen() in Python 3 raises an Exception on 500
opener = urllib.request.OpenerDirector()
opener.add_handler(urllib.request.HTTPHandler())
rv = opener.open('http://%s/?foo=bar&baz=blah' % addr).read()
assert b'Internal Server Error' in rv


def suite():
Expand Down

0 comments on commit c1401e6

Please sign in to comment.