[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/5] qemu-iotests: Fix FilePaths docstring
From: |
Nir Soffer |
Subject: |
[PATCH v2 2/5] qemu-iotests: Fix FilePaths docstring |
Date: |
Fri, 21 Aug 2020 02:54:24 +0300 |
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):
+ # 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
- [PATCH v2 0/5] iotest.FilePath fixes and cleanups, Nir Soffer, 2020/08/20
- [PATCH v2 1/5] qemu-iotests: Fix FilePaths cleanup, Nir Soffer, 2020/08/20
- [PATCH v2 2/5] qemu-iotests: Fix FilePaths docstring,
Nir Soffer <=
- [PATCH v2 3/5] qemu-iotests: Support varargs syntax in FilePaths, Nir Soffer, 2020/08/20
- [PATCH v2 4/5] qemu-iotests: Merge FilePaths and FilePath, Nir Soffer, 2020/08/20
- [PATCH v2 5/5] qemu-iotests: Simplify FilePath __init__, Nir Soffer, 2020/08/20
- Re: [PATCH v2 0/5] iotest.FilePath fixes and cleanups, Kevin Wolf, 2020/08/25