diff options
| author | John Snow <jsnow@redhat.com> | 2022-04-18 17:15:00 -0400 |
|---|---|---|
| committer | Hanna Reitz <hreitz@redhat.com> | 2022-04-25 14:30:29 +0200 |
| commit | 7acb2ddfece87fe0995388ae5f9269570530e2f9 (patch) | |
| tree | f9420368002d70270c4023ac1cc94ff6007ed194 /tests/qemu-iotests/iotests.py | |
| parent | 6dede6a493d245170e90f316883c966542f05bb5 (diff) | |
| download | focaccia-qemu-7acb2ddfece87fe0995388ae5f9269570530e2f9.tar.gz focaccia-qemu-7acb2ddfece87fe0995388ae5f9269570530e2f9.zip | |
iotests/migration-permissions: use assertRaises() for qemu_io() negative test
Modify this test to use assertRaises for its negative testing of qemu_io. If the exception raised does not match the one we tell it to expect, we get *that* exception unhandled. If we get no exception, we get a unittest assertion failure and the provided emsg printed to screen. If we get the CalledProcessError exception but the output is not what we expect, we re-raise the original CalledProcessError. Tidy. (Note: Yes, you can reference "with" objects after that block ends; it just means that ctx.__exit__(...) will have been called on it. It does not *actually* go out of scope. unittests expects you to want to inspect the Exception object, so they leave it defined post-exit.) Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220418211504.943969-9-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/iotests.py')
0 files changed, 0 insertions, 0 deletions