Merge pull request #4 from sprockets/fix-py3

Make tests Python 3 compatible.
This commit is contained in:
AWeberChrisMcGuire 2014-11-20 08:39:42 -05:00
commit 2a55388bf9
2 changed files with 23 additions and 3 deletions

View file

@ -46,7 +46,7 @@ class TestHTTPError(testing.AsyncHTTPTestCase):
def test_tornado_thrown_exception(self): def test_tornado_thrown_exception(self):
response = self.fetch('/') response = self.fetch('/')
expected = {'message': 'Unexpected Error', 'type': 'Bad Request'} expected = {'message': 'Unexpected Error', 'type': 'Bad Request'}
self.assertEqual(json.loads(response.body), expected) self.assertEqual(json.loads(response.body.decode('utf-8')), expected)
class TestCustomExceptions(testing.AsyncHTTPTestCase): class TestCustomExceptions(testing.AsyncHTTPTestCase):
@ -61,7 +61,7 @@ class TestCustomExceptions(testing.AsyncHTTPTestCase):
'type': 'FailureError', 'type': 'FailureError',
'documentation_url': 'http://www.example.com', 'documentation_url': 'http://www.example.com',
} }
self.assertEqual(json.loads(response.body), expected) self.assertEqual(json.loads(response.body.decode('utf-8')), expected)
class TestUnexpectedError(testing.AsyncHTTPTestCase): class TestUnexpectedError(testing.AsyncHTTPTestCase):
@ -75,4 +75,4 @@ class TestUnexpectedError(testing.AsyncHTTPTestCase):
'message': 'Unexpected Error', 'message': 'Unexpected Error',
'type': 'Internal Server Error' 'type': 'Internal Server Error'
} }
self.assertEqual(json.loads(response.body), expected) self.assertEqual(json.loads(response.body.decode('utf-8')), expected)

20
tox.ini Normal file
View file

@ -0,0 +1,20 @@
[tox]
envlist = py26,py27,py33,py34,pypy
indexserver =
default = https://warehouse.python.org/simple
[testenv]
commands = nosetests tests
deps =
-rtest-requirements.txt
tox
[testenv:py27]
deps =
{[testenv]deps}
mock
[testenv:py26]
deps =
{[testenv:py27]deps}
unittest2