[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 5/5] qemu-iotests: Simplify FilePath __init__
From: |
Nir Soffer |
Subject: |
[PATCH v2 5/5] qemu-iotests: Simplify FilePath __init__ |
Date: |
Fri, 21 Aug 2020 02:54:27 +0300 |
Use list comprehension instead of append loop.
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
---
tests/qemu-iotests/iotests.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 1b5cdd493e..7ebd0bcc92 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -467,9 +467,8 @@ class FilePath:
"""
def __init__(self, *names, base_dir=test_dir):
- self.paths = []
- for name in names:
- self.paths.append(os.path.join(base_dir, file_pattern(name)))
+ self.paths = [os.path.join(base_dir, file_pattern(name))
+ for name in names]
def __enter__(self):
if len(self.paths) == 1:
--
2.26.2
- [PATCH v2 1/5] qemu-iotests: Fix FilePaths cleanup, (continued)
- [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, 2020/08/20
- [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 <=
- Re: [PATCH v2 0/5] iotest.FilePath fixes and cleanups, Kevin Wolf, 2020/08/25