tests/avocado: Replace assertEquals() for Python 3.12 compatibility

assertEquals() has been removed in Python 3.12 and should be replaced by
assertEqual(). See: https://docs.python.org/3.12/whatsnew/3.12.html#id3

Message-ID: <20231114134326.287242-1-thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Thomas Huth 2023-11-14 14:43:26 +01:00
parent 34a5cb6d84
commit 861f724d03
5 changed files with 53 additions and 52 deletions

View File

@ -1077,7 +1077,7 @@ and hypothetical example follows:
'human-monitor-command',
command_line='info version')
self.assertEquals(first_res, second_res, third_res)
self.assertEqual(first_res, second_res, third_res)
At test "tear down", ``avocado_qemu.Test`` handles all the QEMUMachines
shutdown.

View File

@ -32,4 +32,4 @@ class QueryCPUModelExpansion(QemuSystemTest):
model = {'name': c['name']}
e = self.vm.cmd('query-cpu-model-expansion', model=model,
type='full')
self.assertEquals(e['model']['name'], c['name'])
self.assertEqual(e['model']['name'], c['name'])

View File

@ -15,5 +15,5 @@ class EmptyCPUModel(QemuSystemTest):
self.vm.set_qmp_monitor(enabled=False)
self.vm.launch()
self.vm.wait()
self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
self.assertRegex(self.vm.get_log(), r'-cpu option cannot be empty')

View File

@ -32,4 +32,4 @@ class OmittedCPUProps(QemuSystemTest):
self.vm.add_args('-smp', '1,sockets=2,cores=2,threads=2,maxcpus=8')
self.vm.add_args('-device', 'qemu64-x86_64-cpu,socket-id=1,core-id=0,thread-id=0')
self.vm.launch()
self.assertEquals(len(self.vm.cmd('query-cpus-fast')), 2)
self.assertEqual(len(self.vm.cmd('query-cpus-fast')), 2)

View File

@ -121,94 +121,95 @@ class X86CPUModelAliases(avocado_qemu.QemuSystemTest):
self.assertFalse(cpus['Cascadelake-Server']['static'],
'unversioned Cascadelake-Server CPU model must not be static')
self.assertEquals(cpus['Cascadelake-Server'].get('alias-of'), 'Cascadelake-Server-v1',
'Cascadelake-Server must be an alias of Cascadelake-Server-v1')
self.assertEqual(cpus['Cascadelake-Server'].get('alias-of'),
'Cascadelake-Server-v1',
'Cascadelake-Server must be an alias of Cascadelake-Server-v1')
self.assertNotIn('alias-of', cpus['Cascadelake-Server-v1'],
'Cascadelake-Server-v1 must not be an alias')
self.assertFalse(cpus['qemu64']['static'],
'unversioned qemu64 CPU model must not be static')
self.assertEquals(cpus['qemu64'].get('alias-of'), 'qemu64-v1',
'qemu64 must be an alias of qemu64-v1')
self.assertEqual(cpus['qemu64'].get('alias-of'), 'qemu64-v1',
'qemu64 must be an alias of qemu64-v1')
self.assertNotIn('alias-of', cpus['qemu64-v1'],
'qemu64-v1 must not be an alias')
self.validate_variant_aliases(cpus)
# On pc-*-4.1, -noTSX and -IBRS models should be aliases:
self.assertEquals(cpus["Haswell"].get('alias-of'),
"Haswell-v1",
self.assertEqual(cpus["Haswell"].get('alias-of'),
"Haswell-v1",
"Haswell must be an alias")
self.assertEquals(cpus["Haswell-noTSX"].get('alias-of'),
"Haswell-v2",
self.assertEqual(cpus["Haswell-noTSX"].get('alias-of'),
"Haswell-v2",
"Haswell-noTSX must be an alias")
self.assertEquals(cpus["Haswell-IBRS"].get('alias-of'),
"Haswell-v3",
self.assertEqual(cpus["Haswell-IBRS"].get('alias-of'),
"Haswell-v3",
"Haswell-IBRS must be an alias")
self.assertEquals(cpus["Haswell-noTSX-IBRS"].get('alias-of'),
"Haswell-v4",
self.assertEqual(cpus["Haswell-noTSX-IBRS"].get('alias-of'),
"Haswell-v4",
"Haswell-noTSX-IBRS must be an alias")
self.assertEquals(cpus["Broadwell"].get('alias-of'),
"Broadwell-v1",
self.assertEqual(cpus["Broadwell"].get('alias-of'),
"Broadwell-v1",
"Broadwell must be an alias")
self.assertEquals(cpus["Broadwell-noTSX"].get('alias-of'),
"Broadwell-v2",
self.assertEqual(cpus["Broadwell-noTSX"].get('alias-of'),
"Broadwell-v2",
"Broadwell-noTSX must be an alias")
self.assertEquals(cpus["Broadwell-IBRS"].get('alias-of'),
"Broadwell-v3",
self.assertEqual(cpus["Broadwell-IBRS"].get('alias-of'),
"Broadwell-v3",
"Broadwell-IBRS must be an alias")
self.assertEquals(cpus["Broadwell-noTSX-IBRS"].get('alias-of'),
"Broadwell-v4",
self.assertEqual(cpus["Broadwell-noTSX-IBRS"].get('alias-of'),
"Broadwell-v4",
"Broadwell-noTSX-IBRS must be an alias")
self.assertEquals(cpus["Nehalem"].get('alias-of'),
"Nehalem-v1",
self.assertEqual(cpus["Nehalem"].get('alias-of'),
"Nehalem-v1",
"Nehalem must be an alias")
self.assertEquals(cpus["Nehalem-IBRS"].get('alias-of'),
"Nehalem-v2",
self.assertEqual(cpus["Nehalem-IBRS"].get('alias-of'),
"Nehalem-v2",
"Nehalem-IBRS must be an alias")
self.assertEquals(cpus["Westmere"].get('alias-of'),
"Westmere-v1",
self.assertEqual(cpus["Westmere"].get('alias-of'),
"Westmere-v1",
"Westmere must be an alias")
self.assertEquals(cpus["Westmere-IBRS"].get('alias-of'),
"Westmere-v2",
self.assertEqual(cpus["Westmere-IBRS"].get('alias-of'),
"Westmere-v2",
"Westmere-IBRS must be an alias")
self.assertEquals(cpus["SandyBridge"].get('alias-of'),
"SandyBridge-v1",
self.assertEqual(cpus["SandyBridge"].get('alias-of'),
"SandyBridge-v1",
"SandyBridge must be an alias")
self.assertEquals(cpus["SandyBridge-IBRS"].get('alias-of'),
"SandyBridge-v2",
self.assertEqual(cpus["SandyBridge-IBRS"].get('alias-of'),
"SandyBridge-v2",
"SandyBridge-IBRS must be an alias")
self.assertEquals(cpus["IvyBridge"].get('alias-of'),
"IvyBridge-v1",
self.assertEqual(cpus["IvyBridge"].get('alias-of'),
"IvyBridge-v1",
"IvyBridge must be an alias")
self.assertEquals(cpus["IvyBridge-IBRS"].get('alias-of'),
"IvyBridge-v2",
self.assertEqual(cpus["IvyBridge-IBRS"].get('alias-of'),
"IvyBridge-v2",
"IvyBridge-IBRS must be an alias")
self.assertEquals(cpus["Skylake-Client"].get('alias-of'),
"Skylake-Client-v1",
self.assertEqual(cpus["Skylake-Client"].get('alias-of'),
"Skylake-Client-v1",
"Skylake-Client must be an alias")
self.assertEquals(cpus["Skylake-Client-IBRS"].get('alias-of'),
"Skylake-Client-v2",
self.assertEqual(cpus["Skylake-Client-IBRS"].get('alias-of'),
"Skylake-Client-v2",
"Skylake-Client-IBRS must be an alias")
self.assertEquals(cpus["Skylake-Server"].get('alias-of'),
"Skylake-Server-v1",
self.assertEqual(cpus["Skylake-Server"].get('alias-of'),
"Skylake-Server-v1",
"Skylake-Server must be an alias")
self.assertEquals(cpus["Skylake-Server-IBRS"].get('alias-of'),
"Skylake-Server-v2",
self.assertEqual(cpus["Skylake-Server-IBRS"].get('alias-of'),
"Skylake-Server-v2",
"Skylake-Server-IBRS must be an alias")
self.assertEquals(cpus["EPYC"].get('alias-of'),
"EPYC-v1",
self.assertEqual(cpus["EPYC"].get('alias-of'),
"EPYC-v1",
"EPYC must be an alias")
self.assertEquals(cpus["EPYC-IBPB"].get('alias-of'),
"EPYC-v2",
self.assertEqual(cpus["EPYC-IBPB"].get('alias-of'),
"EPYC-v2",
"EPYC-IBPB must be an alias")
self.validate_aliases(cpus)