[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 13/17] iotests/migration-permissions: use assertRaises() f
From: |
Eric Blake |
Subject: |
Re: [PATCH v2 13/17] iotests/migration-permissions: use assertRaises() for qemu_io() negative test |
Date: |
Thu, 24 Mar 2022 20:36:06 -0500 |
User-agent: |
NeoMutt/20211029-512-43304b |
On Thu, Mar 24, 2022 at 02:30:14PM -0400, John Snow wrote:
> 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.)
Thanks for adding that paragraph.
>
> 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>
> ---
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- [PATCH v2 07/17] iotests: rebase qemu_io() on top of qemu_tool(), (continued)
- [PATCH v2 07/17] iotests: rebase qemu_io() on top of qemu_tool(), John Snow, 2022/03/24
- [PATCH v2 10/17] iotests/205: fixup, John Snow, 2022/03/24
- [PATCH v2 11/17] iotests/245: fixup, John Snow, 2022/03/24
- [PATCH v2 09/17] iotests/149: fixup, John Snow, 2022/03/24
- [PATCH v2 02/17] iotests/163: Fix broken qemu-io invocation, John Snow, 2022/03/24
- [PATCH v2 12/17] iotests/migration-permissions: fixup, John Snow, 2022/03/24
- [PATCH v2 06/17] iotests: create generic qemu_tool() function, John Snow, 2022/03/24
- [PATCH v2 01/17] iotests: replace calls to log(qemu_io(...)) with qemu_io_log(), John Snow, 2022/03/24
- [PATCH v2 13/17] iotests/migration-permissions: use assertRaises() for qemu_io() negative test, John Snow, 2022/03/24
- Re: [PATCH v2 13/17] iotests/migration-permissions: use assertRaises() for qemu_io() negative test,
Eric Blake <=
- [PATCH v2 14/17] iotests/image-fleecing: switch to qemu_io(), John Snow, 2022/03/24
- [PATCH v2 08/17] iotests/030: fixup, John Snow, 2022/03/24
- [PATCH v2 17/17] iotests: make qemu_io_log() check return codes by default, John Snow, 2022/03/24
- [PATCH v2 15/17] iotests: remove qemu_io_pipe_and_status(), John Snow, 2022/03/24
- [PATCH v2 16/17] iotests: remove qemu_io_silent() and qemu_io_silent_check()., John Snow, 2022/03/24