qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Jeff Cody <jcody@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, armbru@redhat.com, jsnow@redhat.com,
	stefanha@redhat.com, kwolf@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 3/5] qemu-iotests: add 'blind_remove' for python tests
Date: Wed, 30 Aug 2017 13:13:44 -0500	[thread overview]
Message-ID: <627b615e-b42d-f59c-7b9f-e02fd139a85b@redhat.com> (raw)
In-Reply-To: <aea3a5d63b6937d8bd87afb3741db6c09ea7436e.1504111803.git.jcody@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1151 bytes --]

On 08/30/2017 11:52 AM, Jeff Cody wrote:
> Add a function to attempt to 'blindly' remove a file, without
> throwing an error if the file doesn't exist.
> 
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
>  tests/qemu-iotests/iotests.py | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 7233983..a2088c7 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -57,6 +57,13 @@ qemu_default_machine = os.environ.get('QEMU_DEFAULT_MACHINE')
>  socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper')
>  debug = False
>  
> +def blind_remove(filename):
> +    try:
> +        os.remove(filename)
> +    except OSError, error:

I'm assuming this works for both python 2 and 3?

> +        if error.errno != errno.ENOENT:
> +            raise
> +

Weak, since I'm not the strongest at python, but you can add:
Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

  reply	other threads:[~2017-08-30 18:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 16:52 [Qemu-devel] [PATCH v3 0/5] qemu-iotests: place output in unique dir Jeff Cody
2017-08-30 16:52 ` [Qemu-devel] [PATCH v3 1/5] qemu-iotests: set TEST_DIR to a unique dir for each test Jeff Cody
2017-08-30 22:15   ` John Snow
2017-08-30 22:39     ` Jeff Cody
2017-08-30 16:52 ` [Qemu-devel] [PATCH v3 2/5] qemu-iotests: remove file cleanup from bash tests Jeff Cody
2017-08-30 22:17   ` John Snow
2017-09-05 11:17   ` Kevin Wolf
2017-08-30 16:52 ` [Qemu-devel] [PATCH v3 3/5] qemu-iotests: add 'blind_remove' for python tests Jeff Cody
2017-08-30 18:13   ` Eric Blake [this message]
2017-08-30 22:21     ` John Snow
2017-08-30 16:52 ` [Qemu-devel] [PATCH v3 4/5] qemu-iotests: make python tests attempt to leave intermediate files Jeff Cody
2017-08-30 18:33   ` Eric Blake
2017-08-30 22:28     ` John Snow
2017-08-30 22:35       ` Eric Blake
2017-08-30 22:40         ` John Snow
2017-08-31 15:39           ` Stefan Hajnoczi
2017-08-31 15:47             ` Jeff Cody
2017-09-04  9:51               ` Stefan Hajnoczi
2017-09-04 14:42                 ` Jeff Cody
2017-08-30 16:52 ` [Qemu-devel] [PATCH v3 5/5] qemu-iotests: add option to save temp files on error Jeff Cody
2017-08-30 18:49   ` Eric Blake
2017-08-30 22:38   ` John Snow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=627b615e-b42d-f59c-7b9f-e02fd139a85b@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).