qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/5] qemu-iotests: Fix FilePaths docstring


From: Max Reitz
Subject: Re: [PATCH v2 2/5] qemu-iotests: Fix FilePaths docstring
Date: Tue, 25 Aug 2020 12:48:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 21.08.20 01:54, Nir Soffer wrote:
> When this class was extracted from FilePath, the docstring was not
> updated for generating multiple files, and the example usage was
> referencing unrelated file.
> 
> Fixes: de263986b5dc
> Signed-off-by: Nir Soffer <nsoffer@redhat.com>
> ---
>  tests/qemu-iotests/iotests.py | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 16a04df8a3..f34a1d7ef1 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -450,14 +450,16 @@ def file_pattern(name):
>  
>  class FilePaths:
>      """
> -    FilePaths is an auto-generated filename that cleans itself up.
> +    Context manager generating multiple file names. The generated files are
> +    removed when exiting the context.
>  
> -    Use this context manager to generate filenames and ensure that the file
> -    gets deleted::
> +    Example usage:
> +
> +        with FilePaths(['test.img', 'test.sock']) as (img_path, sock_path):

On second thought, this isn’t a great example because image files and
sockets should go into different base directories.

Max

> +            # Use img_path and sock_path here...
> +
> +        # img_path and sock_path are automatically removed here.
>  
> -        with FilePaths(['test.img']) as img_path:
> -            qemu_img('create', img_path, '1G')
> -        # migration_sock_path is automatically deleted
>      """
>      def __init__(self, names, base_dir=test_dir):
>          self.paths = []
> 


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]