Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.11 support #601

Merged
merged 6 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v1
Expand Down
3 changes: 0 additions & 3 deletions pip.sh

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ python-neutronclient
python-novaclient
python-octaviaclient
python-swiftclient
tenacity
tenacity>8.2.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pin seems a bit strange; is it to error out against something else pinning a lower version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it's strange, something is inducing the resolver to pick tenacity-5.5, I don't know why, although this doesn't lead into any errors.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is pytest now a requirement for py3.11?

not a 'requirement', although nose is no longer maintained, see nose-devs/nose#1118 (comment)

pytest it is then!

paramiko
python-libmaas
requests<2.26 # pin for py3.5 support
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
'juju<3.0',
'juju-wait',
'PyYAML',
'tenacity',
'tenacity>8.2.0',
'python-libmaas',
]

Expand Down
11 changes: 5 additions & 6 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
aiounittest
flake8>=2.2.4
flake8>=5 # Python 3.8 compatibility in pyflakes 2.1.0+
flake8-docstrings
flake8-per-file-ignores
pydocstyle<4.0.0
coverage
mock>=1.2
# For some reason the PyPi distributed wheel of nose differ from the one on
# GitHub, and it does not work with Python 3.10.
nose>=1.3.7;python_version<'3.10'
git+https://github.com/nose-devs/nose.git@release_1.3.7#egg=nose;python_version=='3.10'
pytest
pytest-cov
pytest-asyncio

# TODO: these requirements should be mocked out in unit_tests/__init__.py
async_generator
jinja2
keystoneauth1
oslo.config
python-novaclient
tenacity
tenacity>8.2.0
# pinned until 3.0 regressions are handled: https://github.com/openstack-charmers/zaza/issues/545
juju<3.0
32 changes: 14 additions & 18 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,24 @@
envlist = pep8,py3
skipsdist = True

# NOTES:
# * We avoid the new dependency resolver by pinning pip < 20.3, see
# https://github.com/pypa/pip/issues/9187
# * Pinning dependencies requires tox >= 3.2.0, see
# https://tox.readthedocs.io/en/latest/config.html#conf-requires
# * It is also necessary to pin virtualenv as a newer virtualenv would still
# lead to fetching the latest pip in the func* tox targets, see
# https://stackoverflow.com/a/38133283
requires = pip < 20.3
virtualenv < 20.0
# NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci
minversion = 3.2.0

[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
whitelist_external = juju
passenv = HOME TERM CS_* OS_* TEST_*
deps = -r{toxinidir}/test-requirements.txt
install_command =
{toxinidir}/pip.sh install {opts} {packages}
commands = nosetests --with-coverage --processes=0 --cover-package=zaza {posargs} {toxinidir}/unit_tests
setenv =
VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
allowlist_external =
juju
passenv =
HOME
TERM
CS_*
OS_*
TEST_*
deps =
-r{toxinidir}/test-requirements.txt
commands = pytest --cov=./zaza/ {posargs} {toxinidir}/unit_tests

[testenv:py3]
basepython = python3
Expand Down
2 changes: 2 additions & 0 deletions unit_tests/test_zaza_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import mock
import pytest
import unittest

import unit_tests.utils as ut_utils
Expand All @@ -25,6 +26,7 @@ def tearDownModule():
zaza.clean_up_libjuju_thread()


@pytest.mark.asyncio
class TestController(ut_utils.BaseTestCase):

def setUp(self):
Expand Down
2 changes: 2 additions & 0 deletions unit_tests/test_zaza_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import concurrent
import datetime
import mock
import pytest
import yaml

import unit_tests.utils as ut_utils
Expand Down Expand Up @@ -100,6 +101,7 @@ def tearDownModule():
}}}}}}


@pytest.mark.asyncio
class TestModel(ut_utils.BaseTestCase):

def setUp(self):
Expand Down