From c23edc44a47e160efc7e10013420228f227fb63e Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Wed, 25 Sep 2024 14:25:37 +0100 Subject: [PATCH] Ensure iterator is consumed in tools/cache_urls_for_tests --- tools/cache_urls_for_tests.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/cache_urls_for_tests.py b/tools/cache_urls_for_tests.py index 14c5e78..1b0d1d3 100644 --- a/tools/cache_urls_for_tests.py +++ b/tools/cache_urls_for_tests.py @@ -38,7 +38,7 @@ def download(url): def download_all(cache: str): with ThreadPoolExecutor(max_workers=5) as executor: - executor.map(download, set(iter_test_urls())) + return list(executor.map(download, set(iter_test_urls()))) # Consume iterator if __name__ == "__main__": @@ -47,4 +47,7 @@ def download_all(cache: str): raise SystemExit("Please define VALIDATE_PYPROJECT_CACHE_REMOTE") Path(cache).mkdir(parents=True, exist_ok=True) - download_all(cache) + downloads = download_all(cache) + assert len(downloads) > 0, f"empty {downloads=!r}" # noqa + files = list(map(print, Path(cache).iterdir())) + assert len(files) > 0, f"empty {files=!r}" # noqa