From 3d752cb7bc6019f2fd85cdf8b6635728a5f8c5f5 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Fri, 1 Apr 2022 18:40:37 +0100 Subject: [PATCH] Add script that allow users to preload examples for offline testing --- setuptools/tests/config/downloads/.gitignore | 2 ++ setuptools/tests/config/downloads/preload.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 setuptools/tests/config/downloads/preload.py diff --git a/setuptools/tests/config/downloads/.gitignore b/setuptools/tests/config/downloads/.gitignore index d6b7ef32c8..df3779fc42 100644 --- a/setuptools/tests/config/downloads/.gitignore +++ b/setuptools/tests/config/downloads/.gitignore @@ -1,2 +1,4 @@ * !.gitignore +!__init__.py +!preload.py diff --git a/setuptools/tests/config/downloads/preload.py b/setuptools/tests/config/downloads/preload.py new file mode 100644 index 0000000000..64b3f1c8d5 --- /dev/null +++ b/setuptools/tests/config/downloads/preload.py @@ -0,0 +1,18 @@ +"""This file can be used to preload files needed for testing. + +For example you can use:: + + cd setuptools/tests/config + python -m downloads.preload setupcfg_examples.txt + +to make sure the `setup.cfg` examples are downloaded before starting the tests. +""" +import sys +from pathlib import Path + +from . import retrieve_file, urls_from_file + + +if __name__ == "__main__": + urls = urls_from_file(Path(sys.argv[1])) + list(map(retrieve_file, urls))