Permalink
Browse files

Merge branch 'py3-unit-tests' into develop

Closes #3441

* py3-unit-tests:
  Remove py3 test whitelist
  Update rds to pass on py3
  Update mturk to pass tests on py3
  Update cloudsearchdomain tests to work with py3
  • Loading branch information...
2 parents 7d039d0 + ff5f116 commit 5b2f552d30921b1ac220a48472cbb5a6dea8da3d @jamesls jamesls committed Dec 23, 2015
Showing with 10 additions and 57 deletions.
  1. +2 −2 boto/auth.py
  2. +1 −1 boto/mturk/connection.py
  3. +1 −1 boto/rds/__init__.py
  4. +2 −51 tests/test.py
  5. +4 −2 tests/unit/cloudsearchdomain/test_cloudsearchdomain.py
View
@@ -878,8 +878,8 @@ def __init__(self, *args, **kw):
def _calc_signature(self, params, *args):
boto.log.debug('using _calc_signature_1')
hmac = self._get_hmac()
- keys = params.keys()
- keys.sort(cmp=lambda x, y: cmp(x.lower(), y.lower()))
+ keys = list(params.keys())
+ keys.sort(key=lambda x: x.lower())
pairs = []
for key in keys:
hmac.update(key.encode('utf-8'))
@@ -844,7 +844,7 @@ def _process_response(self, response, marker_elems=None):
body = response.read()
if self.debug == 2:
print(body)
- if '<Errors>' not in body:
+ if '<Errors>' not in body.decode('utf-8'):
rs = ResultSet(marker_elems)
h = handler.XmlHandler(rs, self)
xml.sax.parseString(body, h)
@@ -451,7 +451,7 @@ def create_dbinstance(self,
self.build_list_params(params, l, 'VpcSecurityGroupIds.member')
# Remove any params set to None
- for k, v in params.items():
+ for k, v in list(params.items()):
if v is None: del(params[k])
return self.get_object('CreateDBInstance', params, DBInstance)
View
@@ -28,52 +28,7 @@
from nose.core import run
-# This is a whitelist of unit tests that support Python 3.
-# When porting a new module to Python 3, please update this
-# list so that its tests will run by default. See the
-# `default` target below for more information.
-# We use this instead of test attributes/tags because in
-# order to filter on tags nose must load each test - many
-# will fail to import with Python 3.
-PY3_WHITELIST = (
- 'tests/unit/auth',
- 'tests/unit/beanstalk',
- 'tests/unit/cloudformation',
- 'tests/unit/cloudfront',
- 'tests/unit/cloudsearch',
- 'tests/unit/cloudsearch2',
- 'tests/unit/cloudtrail',
- 'tests/unit/directconnect',
- 'tests/unit/dynamodb',
- 'tests/unit/dynamodb2',
- 'tests/unit/ecs',
- 'tests/unit/elasticache',
- 'tests/unit/emr',
- 'tests/unit/glacier',
- 'tests/unit/iam',
- 'tests/unit/ec2',
- 'tests/unit/kms',
- 'tests/unit/logs',
- 'tests/unit/manage',
- 'tests/unit/mws',
- 'tests/unit/provider',
- 'tests/unit/rds2',
- 'tests/unit/route53',
- 'tests/unit/s3',
- 'tests/unit/sns',
- 'tests/unit/ses',
- 'tests/unit/sqs',
- 'tests/unit/sts',
- 'tests/unit/swf',
- 'tests/unit/utils',
- 'tests/unit/vpc',
- 'tests/unit/test_connection.py',
- 'tests/unit/test_exception.py',
- 'tests/unit/test_regioninfo.py',
-)
-
-
-def main(whitelist=[]):
+def main():
description = ("Runs boto unit and/or integration tests. "
"Arguments will be passed on to nosetests. "
"See nosetests --help for more information.")
@@ -99,11 +54,7 @@ def main(whitelist=[]):
for i, arg in enumerate(remaining_args):
if arg == 'default':
- if sys.version_info[0] == 3:
- del remaining_args[i]
- remaining_args += PY3_WHITELIST
- else:
- remaining_args[i] = 'tests/unit'
+ remaining_args[i] = 'tests/unit'
all_args = [__file__] + attribute_args + remaining_args
print("nose command:", ' '.join(all_args))
@@ -82,7 +82,8 @@ def test_search_with_auth(self):
}
- self.set_http_response(status_code=200, body=json.dumps(response))
+ self.set_http_response(status_code=200,
+ body=json.dumps(response).encode('utf-8'))
search_service.domain_connection = self.service_connection
resp = search_service.search()
@@ -109,7 +110,8 @@ def test_upload_documents_with_auth(self):
"category": ["cat_a", "cat_b", "cat_c"]
}
- self.set_http_response(status_code=200, body=json.dumps(response))
+ self.set_http_response(status_code=200,
+ body=json.dumps(response).encode('utf-8'))
document_service.domain_connection = self.service_connection
document_service.add("1234", document)
resp = document_service.commit()

0 comments on commit 5b2f552

Please sign in to comment.