Updates for py312 compatibility

- Added py312 section to tox.ini [testenv]
- Updated flake8 to 7.1.1 instead of 3.9.2
- Updated unit tests for py312 compatibility

Change-Id: I1f9c130e18aea6a17edeb955ae3649ce370d8df7
This commit is contained in:
Jadon Naas 2024-08-21 18:22:22 +00:00
parent 291a947c82
commit 2954bc6a06
2 changed files with 11 additions and 4 deletions

View File

@ -56,6 +56,13 @@ deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
[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}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:py3] [testenv:py3]
basepython = python3 basepython = python3
deps = deps =
@ -65,7 +72,7 @@ deps =
[testenv:pep8] [testenv:pep8]
basepython = python3 basepython = python3
deps = flake8==3.9.2 deps = flake8==7.1.1
git+https://github.com/juju/charm-tools.git git+https://github.com/juju/charm-tools.git
commands = flake8 {posargs} hooks unit_tests tests actions lib files commands = flake8 {posargs} hooks unit_tests tests actions lib files
charm-proof charm-proof

View File

@ -92,7 +92,7 @@ class PauseTestCase(CharmTestCase):
return True return True
self.service_pause.side_effect = maybe_kill self.service_pause.side_effect = maybe_kill
self.assertRaisesRegexp( self.assertRaisesRegex(
Exception, "haproxy didn't stop cleanly.", Exception, "haproxy didn't stop cleanly.",
actions.actions.pause, self.args) actions.actions.pause, self.args)
self.assertEqual(pause_calls, ["swift-proxy"]) self.assertEqual(pause_calls, ["swift-proxy"])
@ -146,7 +146,7 @@ class ResumeTestCase(CharmTestCase):
return True return True
self.service_resume.side_effect = maybe_kill self.service_resume.side_effect = maybe_kill
self.assertRaisesRegexp( self.assertRaisesRegex(
Exception, "apache2 didn't start cleanly.", Exception, "apache2 didn't start cleanly.",
actions.actions.resume, self.args) actions.actions.resume, self.args)
self.assertEqual(resume_calls, ['swift-proxy', 'memcached']) self.assertEqual(resume_calls, ['swift-proxy', 'memcached'])
@ -294,7 +294,7 @@ class DiskUsageTestCase(CharmTestCase):
self.check_output.assert_called_once_with(['swift-recon', '-d']) self.check_output.assert_called_once_with(['swift-recon', '-d'])
self.action_set.assert_called() self.action_set.assert_called()
self.action_fail.not_called() self.action_fail.assert_not_called()
def test_check_output_failure(self): def test_check_output_failure(self):
"""Ensure that action_fail and action_set are called on """Ensure that action_fail and action_set are called on