Skip to content

Commit c23edc4

Browse files
committed
Ensure iterator is consumed in tools/cache_urls_for_tests
1 parent 6d0e71d commit c23edc4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/cache_urls_for_tests.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def download(url):
3838

3939
def download_all(cache: str):
4040
with ThreadPoolExecutor(max_workers=5) as executor:
41-
executor.map(download, set(iter_test_urls()))
41+
return list(executor.map(download, set(iter_test_urls()))) # Consume iterator
4242

4343

4444
if __name__ == "__main__":
@@ -47,4 +47,7 @@ def download_all(cache: str):
4747
raise SystemExit("Please define VALIDATE_PYPROJECT_CACHE_REMOTE")
4848

4949
Path(cache).mkdir(parents=True, exist_ok=True)
50-
download_all(cache)
50+
downloads = download_all(cache)
51+
assert len(downloads) > 0, f"empty {downloads=!r}" # noqa
52+
files = list(map(print, Path(cache).iterdir()))
53+
assert len(files) > 0, f"empty {files=!r}" # noqa

0 commit comments

Comments
 (0)