On Fri, Oct 06, 2023 at 06:41:25PM +0300, Vladimir Sementsov-Ogievskiy wrote: > In many cases we just want an effect of qmp command and want to raise > on failure. Use vm.cmd() method which does exactly this. > > The commit is generated by command > > git grep -l '\.qmp(' | xargs ./scripts/python_qmp_updater.py > > And then, fix self.assertRaises to expect ExecuteError exception in > tests/qemu-iotests/124 > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@yandex-team.ru> > --- > tests/avocado/vnc.py | 16 +- > tests/qemu-iotests/030 | 168 +++--- > tests/qemu-iotests/040 | 172 +++---- > tests/qemu-iotests/041 | 483 ++++++++---------- > tests/qemu-iotests/045 | 15 +- > tests/qemu-iotests/055 | 62 +-- > tests/qemu-iotests/056 | 77 ++- > tests/qemu-iotests/093 | 42 +- > tests/qemu-iotests/118 | 225 ++++---- > tests/qemu-iotests/124 | 102 ++--
Given you called out a post-modification after the script, I checked that out specifically (everything else does indeed match your script's actions) > +++ b/tests/qemu-iotests/124 > @@ -24,6 +24,7 @@ > import os > import iotests > from iotests import try_remove > +from qemu.qmp.qmp_client import ExecuteError > > > @@ -504,9 +500,8 @@ class TestIncrementalBackup(TestIncrementalBackupBase): > target1 = self.prepare_backup(dr1bm0) > > # Re-run the exact same transaction. > - result = self.vm.qmp('transaction', actions=transaction, > - properties={'completion-mode':'grouped'}) > - self.assert_qmp(result, 'return', {}) > + self.vm.cmd('transaction', actions=transaction, > + properties={'completion-mode':'grouped'}) > > # Both should complete successfully this time. > self.assertTrue(self.wait_qmp_backup(drive0['id'])) > @@ -567,7 +562,7 @@ class TestIncrementalBackup(TestIncrementalBackupBase): > The granularity must always be a power of 2. > ''' > self.assert_no_active_block_jobs() > - self.assertRaises(AssertionError, self.add_bitmap, > + self.assertRaises(ExecuteError, self.add_bitmap, > 'bitmap0', self.drives[0], > granularity=64000) Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org