diff --git a/.travis.yml b/.travis.yml index b416272cf..4f801ed0d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,12 @@ language: python python: 2.7 sudo: false +# A hack to install 3.5, until Travis-CI includes it +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 c3a737759..9b21cf5a8 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1279,18 +1279,18 @@ def _do_refresh_request_test_helper(self, response, content, 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 @@ def _step1_get_device_and_user_codes_fail_helper(self, status, 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 4bf56bf72..344032762 100644 --- a/tests/test_file.py +++ b/tests/test_file.py @@ -151,13 +151,13 @@ def test_token_refresh_store_expires_soon(self): 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 @@ def test_token_refresh_stream_body(self): 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 8e94c012b..5163f6558 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