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] - Changed assertEquals to assertEqual in unit tests Change-Id: I47dd8796415ef7ab811f46cde5669b95bf1acb0f
This commit is contained in:
parent
9e80097585
commit
0f2829b20d
@ -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
|
||||
|
||||
|
9
tox.ini
9
tox.ini
@ -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
|
||||
|
||||
|
@ -44,7 +44,7 @@ class TestGlanceRetrofitter(test_utils.PatchHelper):
|
||||
self.Session.assert_called_once_with(
|
||||
auth=loader.load_from_options(),
|
||||
verify=glance_retrofitter.SYSTEM_CA_BUNDLE)
|
||||
self.assertEquals(result, self.Session())
|
||||
self.assertEqual(result, self.Session())
|
||||
|
||||
def test_get_glance_client(self):
|
||||
self.patch_object(glance_retrofitter.glanceclient, 'Client')
|
||||
@ -55,7 +55,7 @@ class TestGlanceRetrofitter(test_utils.PatchHelper):
|
||||
session, service_type='image', interface='aEndpointType')
|
||||
self.Client.assert_called_once_with(
|
||||
'2', session=session, endpoint=session.auth.get_endpoint())
|
||||
self.assertEquals(result, self.Client())
|
||||
self.assertEqual(result, self.Client())
|
||||
session.reset_mock()
|
||||
result = glance_retrofitter.get_glance_client(
|
||||
session)
|
||||
@ -65,8 +65,8 @@ class TestGlanceRetrofitter(test_utils.PatchHelper):
|
||||
def test_get_product_name(self):
|
||||
self.patch_object(glance_retrofitter.subprocess, 'check_output')
|
||||
self.check_output.return_value = 'aArchitecture'
|
||||
self.assertEquals(glance_retrofitter.get_product_name(),
|
||||
'com.ubuntu.cloud.daily:server:18.04:aArchitecture')
|
||||
self.assertEqual(glance_retrofitter.get_product_name(),
|
||||
'com.ubuntu.cloud.daily:server:18.04:aArchitecture')
|
||||
self.check_output.assert_called_once_with(
|
||||
['dpkg', '--print-architecture'],
|
||||
universal_newlines=True)
|
||||
@ -83,7 +83,7 @@ class TestGlanceRetrofitter(test_utils.PatchHelper):
|
||||
fake_image2 = FakeImage2()
|
||||
|
||||
glance.images.list.return_value = [fake_image1, fake_image2]
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
glance_retrofitter.find_image(glance, {'fake_property': 'real'}),
|
||||
fake_image2)
|
||||
glance.images.list.assert_called_once_with(
|
||||
@ -98,14 +98,14 @@ class TestGlanceRetrofitter(test_utils.PatchHelper):
|
||||
glance.images.list.assert_called_once_with(
|
||||
filters={'source_product_name': 'aProduct',
|
||||
'source_version_name': 'aVersion'})
|
||||
self.assertEquals(result, glance.images.list())
|
||||
self.assertEqual(result, glance.images.list())
|
||||
|
||||
def test_find_source_image(self):
|
||||
self.patch_object(glance_retrofitter, 'get_product_name')
|
||||
self.patch_object(glance_retrofitter, 'find_image')
|
||||
self.get_product_name.return_value = 'aProduct'
|
||||
self.find_image.side_effect = [None, None, None, 'aImage']
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
glance_retrofitter.find_source_image('aGlance', '42.04'),
|
||||
'aImage')
|
||||
self.get_product_name.assert_has_calls([
|
||||
|
@ -66,7 +66,7 @@ class TestOctaviaDiskimageRetrofitCharm(test_utils.PatchHelper):
|
||||
self.patch_object(
|
||||
octavia_diskimage_retrofit.subprocess, 'check_output')
|
||||
self.check_output.return_value = '20.04 LTS\n'
|
||||
self.assertEquals(self.target.get_ubuntu_release(), '20.04')
|
||||
self.assertEqual(self.target.get_ubuntu_release(), '20.04')
|
||||
self.check_output.assert_called_once_with(
|
||||
['distro-info', '-r', '--lts'], universal_newlines=True)
|
||||
self.check_output.reset_mock()
|
||||
@ -113,8 +113,8 @@ class TestOctaviaDiskimageRetrofitCharm(test_utils.PatchHelper):
|
||||
self.patch_object(octavia_diskimage_retrofit.ch_core.hookenv,
|
||||
'log')
|
||||
self.target.handle_auto_retrofit()
|
||||
self.assertEquals(self.log.call_args[0][0],
|
||||
'symlink "' + current_link + '" already exists')
|
||||
self.assertEqual(self.log.call_args[0][0],
|
||||
'symlink "' + current_link + '" already exists')
|
||||
self.symlink.reset_mock()
|
||||
self.is_leader.return_value = False
|
||||
self.target.handle_auto_retrofit()
|
||||
@ -132,8 +132,8 @@ class TestOctaviaDiskimageRetrofitCharm(test_utils.PatchHelper):
|
||||
self.unlink.side_effect = os_error
|
||||
self.patch_object(octavia_diskimage_retrofit.ch_core.hookenv, 'log')
|
||||
self.target.remove_cron_job(fake_link)
|
||||
self.assertEquals(self.log.call_args[0][0],
|
||||
'symlink "' + fake_link + '" does not exist')
|
||||
self.assertEqual(self.log.call_args[0][0],
|
||||
'symlink "' + fake_link + '" does not exist')
|
||||
|
||||
def test_render_shell_wrapper(self):
|
||||
unit_name = 'octavia-diskimage-retrofit/0'
|
||||
|
Loading…
Reference in New Issue
Block a user