Move to Python 3.8
Update Python base version from 3.6 to 3.8. For Zed the minimum Python runtime versions are Python 3.8 and 3.9 [1]. As a third Python version I also added 3.10 already. Removed ThreadedHTTPServer and replaced it with ThreadingHTTPServer from standard library, which is new in Python 3.7. [1]: https://governance.openstack.org/tc/reference/runtimes/zed.html Change-Id: I035c569b4feaa23b00c0cad50c36aaecf06f7848
This commit is contained in:
parent
2376f68bba
commit
737523f3bc
@ -28,12 +28,12 @@ To run the full suite of tests maintained within Octavia.
|
||||
|
||||
|
||||
To run tests for one or more specific test environments(for example, the most
|
||||
common configuration of Python 3.7 and PEP-8), list the environments with the
|
||||
common configuration of Python 3.8 and PEP-8), list the environments with the
|
||||
``-e`` option, separated by spaces:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ tox -e py37,pep8
|
||||
$ tox -e py38,pep8
|
||||
|
||||
See ``tox -l`` for the full list of available test environments.
|
||||
|
||||
|
@ -19,11 +19,10 @@
|
||||
# of metrics. It also aligns the terms to be consistent with Octavia
|
||||
# terminology.
|
||||
|
||||
from http.server import HTTPServer
|
||||
from http.server import SimpleHTTPRequestHandler
|
||||
from http.server import ThreadingHTTPServer
|
||||
import os
|
||||
import signal
|
||||
import socketserver
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
@ -785,12 +784,6 @@ def shutdown_thread(http):
|
||||
http.shutdown()
|
||||
|
||||
|
||||
# TODO(johnsom) Remove and switch to ThreadingHTTPServer once python3.7 is
|
||||
# the minimum version supported.
|
||||
class ThreadedHTTPServer(socketserver.ThreadingMixIn, HTTPServer):
|
||||
daemon_threads = True
|
||||
|
||||
|
||||
def main():
|
||||
global PRINT_REJECTED
|
||||
try:
|
||||
@ -806,15 +799,13 @@ def main():
|
||||
# it gracefully.
|
||||
try:
|
||||
with network_namespace.NetworkNamespace(consts.AMPHORA_NAMESPACE):
|
||||
httpd = ThreadedHTTPServer(('127.0.0.1', 9102),
|
||||
PrometheusProxy)
|
||||
httpd = ThreadingHTTPServer(('127.0.0.1', 9102),
|
||||
PrometheusProxy)
|
||||
shutdownthread = threading.Thread(target=shutdown_thread,
|
||||
args=(httpd,))
|
||||
shutdownthread.start()
|
||||
|
||||
# TODO(johnsom) Uncomment this when we move to
|
||||
# ThreadingHTTPServer
|
||||
# httpd.daemon_threads = True
|
||||
httpd.daemon_threads = True
|
||||
print("Now serving on port 9102")
|
||||
httpd.serve_forever()
|
||||
except Exception:
|
||||
|
@ -147,10 +147,7 @@ class TestPrometheusProxyCMD(base.TestCase):
|
||||
mock_http.shutdown.assert_called_once()
|
||||
|
||||
@mock.patch('threading.Thread')
|
||||
# TODO(johnsom) Switch this when we move to ThreadingHTTPServer
|
||||
# @mock.patch('http.server.ThreadingHTTPServer.serve_forever')
|
||||
@mock.patch('octavia.cmd.prometheus_proxy.ThreadedHTTPServer.'
|
||||
'serve_forever')
|
||||
@mock.patch('http.server.ThreadingHTTPServer.serve_forever')
|
||||
@mock.patch('octavia.amphorae.backends.utils.network_namespace.'
|
||||
'NetworkNamespace.__exit__')
|
||||
@mock.patch('octavia.amphorae.backends.utils.network_namespace.'
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Update Python base version from 3.6 to 3.8. As per Openstack Python
|
||||
runtime versions policy Python 3.8 will be the the minimum Python version
|
||||
in the Zed release cycle.
|
@ -6,7 +6,7 @@ description_file =
|
||||
author = OpenStack
|
||||
author_email = openstack-discuss@lists.openstack.org
|
||||
home_page = https://docs.openstack.org/octavia/latest/
|
||||
python_requires = >=3.6
|
||||
python_requires = >=3.8
|
||||
classifier =
|
||||
Development Status :: 5 - Production/Stable
|
||||
Environment :: OpenStack
|
||||
@ -17,10 +17,9 @@ classifier =
|
||||
Operating System :: POSIX :: Linux
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.6
|
||||
Programming Language :: Python :: 3.7
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Programming Language :: Python :: 3.10
|
||||
|
||||
[files]
|
||||
packages =
|
||||
|
16
tox.ini
16
tox.ini
@ -55,18 +55,18 @@ setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
|
||||
basepython = python3
|
||||
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
|
||||
|
||||
[testenv:functional-py36]
|
||||
basepython = python3.6
|
||||
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
|
||||
|
||||
[testenv:functional-py37]
|
||||
basepython = python3.7
|
||||
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
|
||||
|
||||
[testenv:functional-py38]
|
||||
basepython = python3.8
|
||||
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
|
||||
|
||||
[testenv:functional-py39]
|
||||
basepython = python3.9
|
||||
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
|
||||
|
||||
[testenv:functional-py310]
|
||||
basepython = python3.10
|
||||
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
|
||||
|
||||
[testenv:debug]
|
||||
commands = oslo_debug_helper {posargs}
|
||||
|
||||
|
@ -113,14 +113,14 @@
|
||||
name: octavia-tox-tips
|
||||
check:
|
||||
jobs:
|
||||
- octavia-tox-py37-tips
|
||||
- octavia-tox-functional-py37-tips
|
||||
- octavia-tox-py39-tips
|
||||
- octavia-tox-functional-py39-tips
|
||||
|
||||
- job:
|
||||
name: octavia-tox-py37-tips
|
||||
parent: openstack-tox-py37
|
||||
name: octavia-tox-py39-tips
|
||||
parent: openstack-tox-py39
|
||||
description: |
|
||||
Run tox python 3.7 unit tests against master of related libraries.
|
||||
Run tox python 3.9 unit tests against master of related libraries.
|
||||
vars:
|
||||
tox_install_siblings: true
|
||||
zuul_work_dir: src/opendev.org/openstack/octavia
|
||||
@ -129,10 +129,10 @@
|
||||
- openstack/octavia
|
||||
|
||||
- job:
|
||||
name: octavia-tox-functional-py37-tips
|
||||
parent: openstack-tox-functional-py37
|
||||
name: octavia-tox-functional-py39-tips
|
||||
parent: openstack-tox-functional-py39
|
||||
description: |
|
||||
Run tox python 3.7 functional against master of related libraries.
|
||||
Run tox python 3.9 functional against master of related libraries.
|
||||
vars:
|
||||
tox_install_siblings: true
|
||||
zuul_work_dir: src/opendev.org/openstack/octavia
|
||||
|
@ -20,7 +20,7 @@
|
||||
- ^etc/.*$
|
||||
- ^octavia/tests/.*$
|
||||
- ^releasenotes/.*$
|
||||
- openstack-tox-functional-py36:
|
||||
- openstack-tox-functional-py38:
|
||||
irrelevant-files:
|
||||
- ^.*\.rst$
|
||||
- ^api-ref/.*$
|
||||
@ -28,6 +28,23 @@
|
||||
- ^etc/.*$
|
||||
- ^octavia/tests/unit/.*$
|
||||
- ^releasenotes/.*$
|
||||
- openstack-tox-functional-py39:
|
||||
irrelevant-files:
|
||||
- ^.*\.rst$
|
||||
- ^api-ref/.*$
|
||||
- ^doc/.*$
|
||||
- ^etc/.*$
|
||||
- ^octavia/tests/unit/.*$
|
||||
- ^releasenotes/.*$
|
||||
- openstack-tox-functional-py310:
|
||||
irrelevant-files:
|
||||
- ^.*\.rst$
|
||||
- ^api-ref/.*$
|
||||
- ^doc/.*$
|
||||
- ^etc/.*$
|
||||
- ^octavia/tests/unit/.*$
|
||||
- ^releasenotes/.*$
|
||||
voting: false
|
||||
- octavia-v2-dsvm-noop-api:
|
||||
irrelevant-files: &irrelevant-files
|
||||
- ^.*\.rst$
|
||||
@ -86,7 +103,7 @@
|
||||
- ^etc/.*$
|
||||
- ^octavia/tests/.*$
|
||||
- ^releasenotes/.*$
|
||||
- openstack-tox-functional-py36:
|
||||
- openstack-tox-functional-py38:
|
||||
irrelevant-files:
|
||||
- ^.*\.rst$
|
||||
- ^api-ref/.*$
|
||||
|
Loading…
x
Reference in New Issue
Block a user