From d3916dba212e029a3f5ff5add12c66600fc963d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= <1771332+vlaci@users.noreply.github.com> Date: Wed, 20 Sep 2023 18:25:23 +0200 Subject: [PATCH] chore(ruff): PTH207 Replace `iglob` with `Path.glob` or `Path.rglob` The trivial rewrite fails with this issue: /nix/store/jhflvwr40xbb0xr6jx4311icp9cym1fp-python3-3.10.12/lib/python3.10/pathlib.py:476: in _iterate_directories entry_is_dir = entry.is_dir() E OSError: [Errno 36] File name too long: '/home/vlaci/devel/git/github.com/onekey-sec/unblob/tests/integration/filesystem/extfs/__output__/f_badsymlinks.img_extract/long_link' --- unblob/testing.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unblob/testing.py b/unblob/testing.py index 8522676679..7752eb24b1 100644 --- a/unblob/testing.py +++ b/unblob/testing.py @@ -24,8 +24,12 @@ def configure_logging(tmp_path_factory): # noqa: PT004 def gather_integration_tests(test_data_path: Path): + # Path.glob() trips on some invalid files test_input_dirs = [ - Path(p) for p in glob.iglob(f"{test_data_path}/**/__input__", recursive=True) + Path(p) + for p in glob.iglob( # noqa: PTH207 + f"{test_data_path}/**/__input__", recursive=True + ) ] test_case_dirs = [p.parent for p in test_input_dirs] test_output_dirs = [p / "__output__" for p in test_case_dirs]