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

Fix compat with Python 3.12 #664

Merged
merged 2 commits into from
Jul 22, 2024
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 @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.10', '3.11']
python-version: ['3.8', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand Down
12 changes: 6 additions & 6 deletions unit_tests/test_zaza.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def num4():
return 4

with mock.patch.object(zaza, 'RUN_LIBJUJU_IN_THREAD', new=False):
self.assertEquals(zaza.run(one), 1)
self.assertEquals(zaza.run(one, two), 2)
self.assertEquals(zaza.run(one, two, add1(2)), 3)
self.assertEquals(zaza.run(), None)
self.assertEquals(zaza.run(num4), 4)
self.assertEquals(zaza.run(num4()), 4)
self.assertEqual(zaza.run(one), 1)
self.assertEqual(zaza.run(one, two), 2)
self.assertEqual(zaza.run(one, two, add1(2)), 3)
self.assertEqual(zaza.run(), None)
self.assertEqual(zaza.run(num4), 4)
self.assertEqual(zaza.run(num4()), 4)
12 changes: 6 additions & 6 deletions unit_tests/test_zaza_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ def unit_wl_status(_model, unit, states):
model.wait_for_application_states('modelname', timeout=1,
max_resolve_count=3)
self.assertFalse(self.system_ready)
self.assertEquals(self.async_resolve_units.call_count, 3)
self.assertEqual(self.async_resolve_units.call_count, 3)

def test_wait_for_application_states_retries_non_retryable(self):
self.patch_object(model, 'check_model_for_hard_errors')
Expand Down Expand Up @@ -1512,7 +1512,7 @@ def unit_wl_status(_model, unit, states):
with mock.patch.object(zaza, 'RUN_LIBJUJU_IN_THREAD', new=False):
model.wait_for_application_states('modelname', timeout=500,
max_resolve_count=3)
self.assertEquals(self.async_resolve_units.call_count, 2)
self.assertEqual(self.async_resolve_units.call_count, 2)
self.async_block_until_unit_wl_status.assert_has_calls([
mock.call('app/2', 'error', 'modelname', negate_match=True,
timeout=60),
Expand Down Expand Up @@ -2980,7 +2980,7 @@ async def test_async_get_cloud_data(self):
'fake-cred-name', 'fake-cred')
result = await model.async_get_cloud_data()
self.assertIsInstance(result, model.CloudData)
self.assertEquals(result.cloud_name, mock.ANY)
self.assertEquals(result.cloud, mock.ANY)
self.assertEquals(result.credential_name, 'fake-cred-name')
self.assertEquals(result.credential, 'fake-cred')
self.assertEqual(result.cloud_name, mock.ANY)
self.assertEqual(result.cloud, mock.ANY)
self.assertEqual(result.credential_name, 'fake-cred-name')
self.assertEqual(result.credential, 'fake-cred')
6 changes: 3 additions & 3 deletions unit_tests/utilities/test_zaza_utilities_launchpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_get_ubuntu_series(self):
r = unittest.mock.MagicMock()
r.text = json.dumps(expect)
self.get.return_value = r
self.assertEquals(
self.assertEqual(
launchpad.get_ubuntu_series(),
expect,
)
Expand All @@ -40,7 +40,7 @@ def test_get_ubuntu_series_by_version(self):
self.get_ubuntu_series.return_value = {
'entries': [{'version': 'fakeVersion'}]}

self.assertEquals(
self.assertEqual(
launchpad.get_ubuntu_series_by_version(),
{'fakeVersion': {'version': 'fakeVersion'}})

Expand All @@ -50,6 +50,6 @@ def test_get_ubuntu_series_by_name(self):
self.get_ubuntu_series.return_value = {
'entries': [{'name': 'fakeName'}]}

self.assertEquals(
self.assertEqual(
launchpad.get_ubuntu_series_by_name(),
{'fakeName': {'name': 'fakeName'}})
10 changes: 5 additions & 5 deletions unit_tests/utilities/test_zaza_utilities_maas.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async def af():
def test_get_macs_from_cidr(self):
try:
self.maxDiff = None
self.assertEquals(
self.assertEqual(
maas.get_macs_from_cidr(self.maas_client, '192.0.2.0/24'),
[
maas.MachineInterfaceMac(
Expand All @@ -110,7 +110,7 @@ def test_get_macs_from_cidr(self):
'192.0.2.0/24',
mock.ANY),
])
self.assertEquals(
self.assertEqual(
maas.get_macs_from_cidr(self.maas_client, '192.0.2.0/24',
link_mode=maas.LinkMode.LINK_UP),
[
Expand All @@ -121,7 +121,7 @@ def test_get_macs_from_cidr(self):
'192.0.2.0/24',
maas.LinkMode.LINK_UP),
])
self.assertEquals(
self.assertEqual(
maas.get_macs_from_cidr(self.maas_client, '192.0.2.0/24',
link_mode=maas.LinkMode.AUTO),
[
Expand All @@ -132,7 +132,7 @@ def test_get_macs_from_cidr(self):
'192.0.2.0/24',
maas.LinkMode.AUTO),
])
self.assertEquals(
self.assertEqual(
maas.get_macs_from_cidr(self.maas_client, '198.51.100.0/24'),
[
maas.MachineInterfaceMac(
Expand All @@ -152,7 +152,7 @@ def test_get_macs_from_cidr(self):
async def fget(*args):
return self.machine2
self.maas_client.machines.get.side_effect = fget
self.assertEquals(
self.assertEqual(
maas.get_macs_from_cidr(self.maas_client, '198.51.100.0/24',
machine_id=self.machine2.system_id),
[
Expand Down
4 changes: 2 additions & 2 deletions unit_tests/utilities/test_zaza_utilities_machine_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_add_netdevsim(self):
self.patch_object(machine_os_utils.zaza.utilities.juju, 'remote_run')
result = machine_os_utils.add_netdevsim(
'unit', 10, 2, model_name='model')
self.assertEquals(result, ['eni10np1', 'eni10np2'])
self.assertEqual(result, ['eni10np1', 'eni10np2'])
self.install_modules_extra.assert_called_once_with(
'unit', model_name='model')
self.load_kernel_module.assert_called_once_with(
Expand Down Expand Up @@ -139,7 +139,7 @@ def test_get_hv_application(self):
self.get_config_options.return_value = {
machine_os_utils.HV_APPLICATION_KEY: 'someApp'
}
self.assertEquals(machine_os_utils.get_hv_application(), 'someApp')
self.assertEqual(machine_os_utils.get_hv_application(), 'someApp')

def test_reboot_hvs(self):
# No hv_application
Expand Down
4 changes: 2 additions & 2 deletions unit_tests/utilities/test_zaza_utilities_networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
class TestUtils(unittest.TestCase):

def test_format_addr(self):
self.assertEquals('1.2.3.4', network_utils.format_addr('1.2.3.4'))
self.assertEquals(
self.assertEqual('1.2.3.4', network_utils.format_addr('1.2.3.4'))
self.assertEqual(
'[2001:db8::42]', network_utils.format_addr('2001:db8::42'))
with self.assertRaises(ValueError):
network_utils.format_addr('999.999.999.999')
Expand Down
Loading