diff --git a/.travis.yml b/.travis.yml index b416272..c66632c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,12 @@ language: python python: 2.7 sudo: false +# TODO(issue 532): Fix syntax when 3.5 is natively available upstream +matrix: + include: + - python: 3.5 + env: + - TOX_ENV=py35 env: matrix: - TOX_ENV=py26 diff --git a/tests/test_client.py b/tests/test_client.py index c3a7377..9b21cf5 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1279,18 +1279,18 @@ class BasicCredentialsTests(unittest2.TestCase): def test__do_refresh_request_non_json_failure(self): response = httplib2.Response({ - 'status': http_client.BAD_REQUEST, + 'status': int(http_client.BAD_REQUEST), }) content = u'Bad request' - error_msg = 'Invalid response %s.' % (response.status,) + error_msg = 'Invalid response %s.' % (int(response.status),) self._do_refresh_request_test_helper(response, content, error_msg) def test__do_refresh_request_basic_failure(self): response = httplib2.Response({ - 'status': http_client.INTERNAL_SERVER_ERROR, + 'status': int(http_client.INTERNAL_SERVER_ERROR), }) content = u'{}' - error_msg = 'Invalid response %s.' % (response.status,) + error_msg = 'Invalid response %s.' % (int(response.status),) self._do_refresh_request_test_helper(response, content, error_msg) def test__do_refresh_request_failure_w_json_error(self): @@ -1828,21 +1828,21 @@ class OAuth2WebServerFlowTest(unittest2.TestCase): self.assertEqual(exc_manager.exception.args, (error_msg,)) def test_step1_get_device_and_user_codes_non_json_failure(self): - status = http_client.BAD_REQUEST + status = int(http_client.BAD_REQUEST) content = 'Nope not JSON.' error_msg = 'Invalid response %s.' % (status,) self._step1_get_device_and_user_codes_fail_helper(status, content, error_msg) def test_step1_get_device_and_user_codes_basic_failure(self): - status = http_client.INTERNAL_SERVER_ERROR + status = int(http_client.INTERNAL_SERVER_ERROR) content = b'{}' error_msg = 'Invalid response %s.' % (status,) self._step1_get_device_and_user_codes_fail_helper(status, content, error_msg) def test_step1_get_device_and_user_codes_failure_w_json_error(self): - status = http_client.BAD_GATEWAY + status = int(http_client.BAD_GATEWAY) base_error = 'ZOMG user codes failure.' content = json.dumps({'error': base_error}) error_msg = 'Invalid response %s. Error: %s' % (status, base_error) diff --git a/tests/test_file.py b/tests/test_file.py index 4bf56bf..3440327 100644 --- a/tests/test_file.py +++ b/tests/test_file.py @@ -151,13 +151,13 @@ class OAuth2ClientFileTests(unittest2.TestCase): access_token = '1/3w' token_response = {'access_token': access_token, 'expires_in': 3600} http = HttpMockSequence([ - ({'status': str(http_client.UNAUTHORIZED)}, + ({'status': str(int(http_client.UNAUTHORIZED))}, b'Initial token expired'), - ({'status': str(http_client.UNAUTHORIZED)}, + ({'status': str(int(http_client.UNAUTHORIZED))}, b'Store token expired'), - ({'status': str(http_client.OK)}, + ({'status': str(int(http_client.OK))}, json.dumps(token_response).encode('utf-8')), - ({'status': str(http_client.OK)}, + ({'status': str(int(http_client.OK))}, b'Valid response to original request') ]) @@ -196,13 +196,13 @@ class OAuth2ClientFileTests(unittest2.TestCase): token_response = {'access_token': valid_access_token, 'expires_in': 3600} http = HttpMockSequence([ - ({'status': str(http_client.UNAUTHORIZED)}, + ({'status': str(int(http_client.UNAUTHORIZED))}, b'Initial token expired'), - ({'status': str(http_client.UNAUTHORIZED)}, + ({'status': str(int(http_client.UNAUTHORIZED))}, b'Store token expired'), - ({'status': str(http_client.OK)}, + ({'status': str(int(http_client.OK))}, json.dumps(token_response).encode('utf-8')), - ({'status': str(http_client.OK)}, 'echo_request_body') + ({'status': str(int(http_client.OK))}, 'echo_request_body') ]) body = six.StringIO('streaming body') diff --git a/tox.ini b/tox.ini index 8e94c01..5163f65 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py26,py27,py33,py34,pypy,gae,cover +envlist = py26,py27,py33,py34,py35,pypy,gae,cover [testenv] basedeps = mock>=1.3.0