From 0948724aea0fa1518fe78f65651714655a88ca62 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Sun, 10 May 2015 12:43:58 -0400 Subject: [PATCH] Fix last unit tests on py34 This commit fixes the last remaining issues in the tempest unit tests. There were several failures for a couple of different issues previously but after this running the tempest unit tests will pass on python 3.4. Change-Id: Icf9090df83f8266a4683c88995c547e3c1bff523 --- tempest/cmd/verify_tempest_config.py | 3 ++- tempest/tests/stress/test_stress.py | 2 +- tempest/tests/test_glance_http.py | 2 +- tempest/tests/test_list_tests.py | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py index 70a8594033..f51d9aa0f7 100755 --- a/tempest/cmd/verify_tempest_config.py +++ b/tempest/cmd/verify_tempest_config.py @@ -94,7 +94,7 @@ def _get_api_versions(os, service): versions = map(lambda x: x['id'], body['versions']['values']) else: versions = map(lambda x: x['id'], body['versions']) - return versions + return list(versions) def verify_keystone_api_versions(os, update): @@ -175,6 +175,7 @@ def verify_extensions(os, service, results): else: extensions = map(lambda x: x['alias'], resp) + extensions = list(extensions) if not results.get(service): results[service] = {} extensions_opt = get_enabled_extensions(service) diff --git a/tempest/tests/stress/test_stress.py b/tempest/tests/stress/test_stress.py index 3a7b436b2b..16f1ac7783 100644 --- a/tempest/tests/stress/test_stress.py +++ b/tempest/tests/stress/test_stress.py @@ -33,7 +33,7 @@ class StressFrameworkTest(base.TestCase): cmd = ' '.join([cmd, param]) LOG.info("running: '%s'" % cmd) cmd_str = cmd - cmd = shlex.split(cmd.encode('utf-8')) + cmd = shlex.split(cmd) result = '' result_err = '' try: diff --git a/tempest/tests/test_glance_http.py b/tempest/tests/test_glance_http.py index b132f6072d..7850ee461e 100644 --- a/tempest/tests/test_glance_http.py +++ b/tempest/tests/test_glance_http.py @@ -137,7 +137,7 @@ class TestGlanceHTTPClient(base.TestCase): resp, body = self.client.raw_request('PUT', '/images', body=req_body) self.assertEqual(200, resp.status) self.assertEqual('fake_response_body', body.read()) - httplib.HTTPConnection.send.assert_call_count(req_body.len) + httplib.HTTPConnection.send.assert_call_count(req_body.tell()) def test_get_connection_class_for_https(self): conn_class = self.client.get_connection_class('https') diff --git a/tempest/tests/test_list_tests.py b/tempest/tests/test_list_tests.py index 19e4c9ce39..38d4c5c0e6 100644 --- a/tempest/tests/test_list_tests.py +++ b/tempest/tests/test_list_tests.py @@ -14,6 +14,7 @@ import os import re +import six import subprocess from tempest.tests import base @@ -32,7 +33,7 @@ class TestTestList(base.TestCase): self.assertEqual(0, p.returncode, "test discovery failed, one or more files cause an " "error on import %s" % ids) - ids = ids.split('\n') + ids = six.text_type(ids).split('\n') for test_id in ids: if re.match('(\w+\.){3}\w+', test_id): if not test_id.startswith('tempest.'):