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

2020-08-25 Thread Nir Soffer
On Tue, Aug 25, 2020 at 1:48 PM Max Reitz  wrote:
>
> 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 
> > ---
> >  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.

Right, will improve it in v3.

>
> 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 = []
> >
>
>




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

2020-08-25 Thread Max Reitz
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 
> ---
>  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 = []
> 




signature.asc
Description: OpenPGP digital signature


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

2020-08-25 Thread Max Reitz
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 
> ---
>  tests/qemu-iotests/iotests.py | 14 --
>  1 file changed, 8 insertions(+), 6 deletions(-)

Reviewed-by: Max Reitz 



signature.asc
Description: OpenPGP digital signature


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

2020-08-20 Thread Nir Soffer
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 
---
 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):
+# 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 = []
-- 
2.26.2