tests/avocado: Replace assertEquals() for Python 3.12 compatibility
PATCH 1/1 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
--- docs/devel/testing.rst | 2 +- tests/avocado/cpu_queries.py | 2 +- tests/avocado/empty_cpu_model.py | 2 +- tests/avocado/pc_cpu_hotplug_props.py | 2 +- tests/avocado/x86_cpu_model_versions.py | 96 ++++++++++++------------- 5 files changed, 52 insertions(+), 52 deletions(-)
docs/devel/testing.rst +1 -1
@@ -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.
tests/avocado/cpu_queries.py +1 -1
@@ -32,4 +32,4 @@ def test(self): 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'])
tests/avocado/empty_cpu_model.py +1 -1
@@ -15,5 +15,5 @@ def test(self): 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')
tests/avocado/pc_cpu_hotplug_props.py +1 -1
@@ -32,4 +32,4 @@ def test_no_die_id(self): 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)
tests/avocado/x86_cpu_model_versions.py +48 -48
142 lines not on this page · raw message
Signature · 1 line
2.41.0
Hi Thomas,
Quoted 2 lines · Thomas Huth
assertEquals()has been removed in Python 3.12 and should be replaced byassertEqual(). See: https://docs.python.org/3.12/whatsnew/3.12.html#id3
From this list I see assertEquals() has been deprecated in 3.2, along with assertRegexpMatches(). No warning for this single use?
tests/avocado/version.py:25: self.assertRegexpMatches(res, r'^(\d+\.\d+\.\d)')
Otherwise,
Quoted 8 lines
Signed-off-by Thomas Huth <[email protected]>--- docs/devel/testing.rst | 2 +- tests/avocado/cpu_queries.py | 2 +- tests/avocado/empty_cpu_model.py | 2 +- tests/avocado/pc_cpu_hotplug_props.py | 2 +- tests/avocado/x86_cpu_model_versions.py | 96 ++++++++++++------------- 5 files changed, 52 insertions(+), 52 deletions(-)
Quoted 6 lines · Philippe Mathieu-Daudé
Hi Thomas,
Quoted 2 lines · Thomas Huth
assertEquals()has been removed in Python 3.12 and should be replaced byassertEqual(). See: https://docs.python.org/3.12/whatsnew/3.12.html#id3
Quoted 7 lines
From this list I see
assertEquals()has been deprecated in 3.2, along
withassertRegexpMatches(). No warning for this single use?tests/avocado/version.py:25:
self.assertRegexpMatches(res, r'^(\d+\.\d+\.\d)')Otherwise,
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Thanks!
I still cannot run all avocado tests yet, so I didn't notice this problem yet. But you're right, if I only run this test manually, it also fails. Care to send a patch, or want me to include it in my patch?
Anyway, I'm seeing also failures here:
tests/avocado/replay_kernel.py:ReplayKernelNormal.test_x86_64_pc: INTERRUPTED tests/avocado/reverse_debugging.py:ReverseDebugging_ppc64.test_ppc64_pseries: INTERRUPTED tests/avocado/reverse_debugging.py:ReverseDebugging_ppc64.test_ppc64_powernv: ERROR
Are these still working for you?
(IIRC at least the replay_kernel test was also failing for me before I upgraded to Fedora 39, so it's likely not related to the new Python version)
Thomas
Quoted 12 lines · Thomas Huth
Quoted 11 lines · Philippe Mathieu-Daudé
Hi Thomas,
Quoted 2 lines · Thomas Huth
assertEquals()has been removed in Python 3.12 and should be replaced byassertEqual(). See: https://docs.python.org/3.12/whatsnew/3.12.html#id3From this list I see
assertEquals()has been deprecated in 3.2, along withassertRegexpMatches(). No warning for this single use?tests/avocado/version.py:25:
self.assertRegexpMatches(res, r'^(\d+\.\d+\.\d)')
Quoted 7 lines
Quoted 2 lines
Otherwise,
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Thanks!
I still cannot run all avocado tests yet, so I didn't notice this problem yet.
At least you can run *some* tests :>
FYI macOS users still can't run QEMU's Avocado test suite. Personally I run it somewhere in a cloud machine.
Quoted 2 lines
But you're right, if I only run this test manually, it also fails. Care to send a patch, or want me to include it in my patch?
OK I'll send.
Quoted 5 lines
Anyway, I'm seeing also failures here:
tests/avocado/replay_kernel.py:ReplayKernelNormal.test_x86_64_pc:
INTERRUPTED
tests/avocado/reverse_debugging.py:ReverseDebugging_ppc64.test_ppc64_pseries: INTERRUPTED
Sometimes due to timeout.
Quoted 1 line
tests/avocado/reverse_debugging.py:ReverseDebugging_ppc64.test_ppc64_powernv: ERROR
This one is concerning.
Quoted 4 lines
Are these still working for you?
(IIRC at least thereplay_kerneltest was also failing for me before I upgraded to Fedora 39, so it's likely not related to the new Python version)
Regards,
Phil.