Fix issues related to py312 compatibility

Summary of changes:
- Bump flake8 from 3.9.2 to 7.1.1
- Remove pinning for setuptools
- Add py312 section to tox.ini [testenv]
- Modify unit test method to work with py312

Change-Id: Iee43b476c9d9aa7b74152595a9327a9838cb528f
This commit is contained in:
Myles Penner 2024-08-20 22:53:40 +00:00
parent 10407d31ee
commit 35af5dcbaf
4 changed files with 13 additions and 6 deletions

View File

@ -6,7 +6,6 @@
# NOTE(lourot): This might look like a duplication of test-requirements.txt but
# some tox targets use only test-requirements.txt whereas charm-build uses only
# requirements.txt
setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85
# NOTE: newer versions of cryptography require a Rust compiler to build,
# see

View File

@ -4,7 +4,6 @@
# https://github.com/openstack-charmers/release-tools
#
pyparsing<3.0.0 # aodhclient is pinned in zaza and needs pyparsing < 3.0.0, but cffi also needs it, so pin here.
setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85
stestr>=2.2.0

View File

@ -64,6 +64,13 @@ deps =
-r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
[testenv:py312]
basepython = python3.12
deps =
-c {env:TEST_CONSTRAINTS_FILE:https://raw.githubusercontent.com/openstack-charmers/zaza-openstack-tests/master/constraints/constraints-2024.1.txt}
-r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
[testenv:py310]
basepython = python3.10
deps =
@ -73,7 +80,7 @@ commands = stestr run --slowest {posargs}
[testenv:pep8]
basepython = python3
deps = flake8==3.9.2
deps = flake8==7.1.1
git+https://github.com/juju/charm-tools.git
commands = flake8 {posargs} src unit_tests

View File

@ -134,13 +134,15 @@ class TestHandlers(test_utils.PatchHelper):
mock.call(
'designate',
'designate',
prefix='designate'),
prefix='designate',
hostname=mock.ANY),
mock.call(
'dpm',
'dpm',
prefix='dpm'),
prefix='dpm',
hostname=mock.ANY),
]
database.configure.has_calls(calls)
database.configure.assert_has_calls(calls)
def test_setup_endpoint(self):
the_charm = self._patch_provide_charm_instance()