From 9a55baa2c89d11a1fcc66ee97daf1ec426c2c1b7 Mon Sep 17 00:00:00 2001 From: Alexander Bashmakov Date: Fri, 14 Apr 2017 00:19:08 +0000 Subject: [PATCH] Clean up py35 env in tox.ini. This patch enables the py35 job in tox.ini to run using ostestr. It also fixes a bytes encoding issue in the 'test_wsgi' functional test to make progress towards the community goal of enabling python3.5. Two other functional tests remain disabled and will need to be addressed in a later patch in order to fully complete the community goal - 'test_ssl' and 'test_reload'. These tests fail due to SSL handshake not working in python3.5 when using self-signed certificate and authority. Change-Id: Ie9071f1a93d8201f754ae3042d6e51b5de6d2e63 --- glance/tests/functional/test_reload.py | 3 +++ glance/tests/functional/test_ssl.py | 3 +++ glance/tests/functional/test_wsgi.py | 4 +-- tox.ini | 36 +++----------------------- 4 files changed, 11 insertions(+), 35 deletions(-) diff --git a/glance/tests/functional/test_reload.py b/glance/tests/functional/test_reload.py index 62d51a2df5..006e020a4b 100644 --- a/glance/tests/functional/test_reload.py +++ b/glance/tests/functional/test_reload.py @@ -16,9 +16,11 @@ import os import re import time +import unittest import psutil import requests +import six from six.moves import http_client as http from glance.tests import functional @@ -101,6 +103,7 @@ class TestReload(functional.FunctionalTest): def _url(self, protocol, path): return '%s://127.0.0.1:%d%s' % (protocol, self.api_port, path) + @unittest.skipIf(six.PY3, 'SSL handshakes are broken in PY3') def test_reload(self): """Test SIGHUP picks up new config values""" def check_pids(pre, post=None, workers=2): diff --git a/glance/tests/functional/test_ssl.py b/glance/tests/functional/test_ssl.py index 7b584c2def..750fdef35c 100644 --- a/glance/tests/functional/test_ssl.py +++ b/glance/tests/functional/test_ssl.py @@ -14,8 +14,10 @@ # under the License. import os +import unittest import httplib2 +import six from six.moves import http_client as http from glance.tests import functional @@ -72,6 +74,7 @@ class TestSSL(functional.FunctionalTest): if getattr(self, 'inited', False): return + @unittest.skipIf(six.PY3, 'SSL handshakes are broken in PY3') def test_ssl_ok(self): """Make sure the public API works with HTTPS.""" self.cleanup() diff --git a/glance/tests/functional/test_wsgi.py b/glance/tests/functional/test_wsgi.py index 40ba3b9420..e375e3b8ae 100644 --- a/glance/tests/functional/test_wsgi.py +++ b/glance/tests/functional/test_wsgi.py @@ -32,7 +32,7 @@ class TestWSGIServer(testtools.TestCase): CONF.set_default("workers", 0) CONF.set_default("client_socket_timeout", 1) """Verify connections are timed out as per 'client_socket_timeout'""" - greetings = 'Hello, World!!!' + greetings = b'Hello, World!!!' def hello_world(env, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]) @@ -46,7 +46,7 @@ class TestWSGIServer(testtools.TestCase): sock = socket.socket() sock.connect(('127.0.0.1', port)) time.sleep(delay) - sock.send('GET / HTTP/1.1\r\nHost: localhost\r\n\r\n') + sock.send(b'GET / HTTP/1.1\r\nHost: localhost\r\n\r\n') return sock.recv(1024) # Should succeed - no timeout diff --git a/tox.ini b/tox.ini index 279d2264cd..03e3b6bdc8 100644 --- a/tox.ini +++ b/tox.ini @@ -39,39 +39,9 @@ passenv = *_proxy *_PROXY commands = ostestr --slowest {posargs} [testenv:py35] -commands = - lockutils-wrapper python setup.py testr --slowest --testr-args='glance.tests.unit' - python -m testtools.run \ - glance.tests.functional.test_cache_middleware \ - glance.tests.functional.test_api \ - glance.tests.functional.test_client_redirects \ - glance.tests.functional.test_glance_manage \ - glance.tests.functional.test_gzip_middleware \ - glance.tests.functional.test_healthcheck_middleware \ - glance.tests.functional.test_client_exceptions \ - glance.tests.functional.test_sqlite \ - glance.tests.functional.test_cors_middleware \ - glance.tests.functional.test_glance_replicator \ - glance.tests.functional.test_scrubber \ - glance.tests.functional.test_logging \ - glance.tests.functional.test_bin_glance_cache_manage \ - glance.tests.functional.db.test_simple \ - glance.tests.functional.db.test_sqlalchemy \ - glance.tests.functional.db.test_rpc_endpoint \ - glance.tests.functional.v1.test_api \ - glance.tests.functional.v1.test_copy_to_file \ - glance.tests.functional.v1.test_misc \ - glance.tests.functional.v1.test_multiprocessing \ - glance.tests.functional.v2.test_metadef_objects \ - glance.tests.functional.v2.test_schemas \ - glance.tests.functional.v2.test_metadef_properties \ - glance.tests.functional.v2.test_metadef_resourcetypes \ - glance.tests.functional.v2.test_metadef_tags \ - glance.tests.functional.v2.test_images \ - glance.tests.functional.v2.test_metadef_namespaces \ - glance.tests.integration.v2.test_tasks_api \ - glance.tests.integration.v2.test_property_quota_violations \ - glance.tests.integration.legacy_functional.test_v1_api +# The periodic oslo-with-master test does not work with the +# conditionals in [testenv], use separate environment. +commands = ostestr --slowest {posargs} [testenv:pep8] commands =