[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 06/16] iotests/297: Add get_files() function
From: |
John Snow |
Subject: |
[PATCH v3 06/16] iotests/297: Add get_files() function |
Date: |
Thu, 16 Sep 2021 00:09:45 -0400 |
Split out file discovery into its own method to begin separating out the
"environment setup" and "test execution" phases.
Signed-off-by: John Snow <jsnow@redhat.com>
---
tests/qemu-iotests/297 | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297
index 3e86f788fc..b3a56a3a29 100755
--- a/tests/qemu-iotests/297
+++ b/tests/qemu-iotests/297
@@ -21,6 +21,7 @@ import re
import shutil
import subprocess
import sys
+from typing import List
import iotests
@@ -56,10 +57,15 @@ def is_python_file(filename: str, directory: str = '.') ->
bool:
return False
+def get_test_files(directory: str = '.') -> List[str]:
+ named_test_dir = os.path.join(directory, 'tests')
+ named_tests = [f"tests/{entry}" for entry in os.listdir(named_test_dir)]
+ check_tests = set(os.listdir(directory) + named_tests) - set(SKIP_FILES)
+ return list(filter(lambda f: is_python_file(f, directory), check_tests))
+
+
def run_linters():
- named_tests = [f'tests/{entry}' for entry in os.listdir('tests')]
- check_tests = set(os.listdir('.') + named_tests) - set(SKIP_FILES)
- files = [filename for filename in check_tests if is_python_file(filename)]
+ files = get_test_files()
iotests.logger.debug('Files to be checked:')
iotests.logger.debug(', '.join(sorted(files)))
--
2.31.1
- [PATCH v3 04/16] iotests/migrate-bitmaps-test: delint, (continued)
- [PATCH v3 05/16] iotests/297: modify is_python_file to work from any CWD, John Snow, 2021/09/16
- [PATCH v3 06/16] iotests/297: Add get_files() function,
John Snow <=
- [PATCH v3 07/16] iotests/297: Don't rely on distro-specific linter binaries, John Snow, 2021/09/16
- [PATCH v3 09/16] iotests/297: Separate environment setup from test execution, John Snow, 2021/09/16
- [PATCH v3 10/16] iotests/297: Add 'directory' argument to run_linters, John Snow, 2021/09/16
- [PATCH v3 08/16] iotests/297: Create main() function, John Snow, 2021/09/16