Merge pull request #4240 from RonnyPfannschmidt/perf-example-collect-files
add script to generate a example folder for collecting many files
This commit is contained in:
commit
ebba3ebe67
|
@ -0,0 +1 @@
|
||||||
|
foo_*
|
|
@ -0,0 +1,28 @@
|
||||||
|
import argparse
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
|
||||||
|
HERE = pathlib.Path(__file__).parent
|
||||||
|
TEST_CONTENT = (HERE / "template_test.py").read_bytes()
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("numbers", nargs="*", type=int)
|
||||||
|
|
||||||
|
|
||||||
|
def generate_folders(root, elements, *more_numbers):
|
||||||
|
fill_len = len(str(elements))
|
||||||
|
if more_numbers:
|
||||||
|
for i in range(elements):
|
||||||
|
new_folder = root.joinpath(f"foo_{i:0>{fill_len}}")
|
||||||
|
new_folder.mkdir()
|
||||||
|
new_folder.joinpath("__init__.py").write_bytes(TEST_CONTENT)
|
||||||
|
generate_folders(new_folder, *more_numbers)
|
||||||
|
else:
|
||||||
|
for i in range(elements):
|
||||||
|
new_test = root.joinpath(f"test_{i:0<{fill_len}}.py")
|
||||||
|
new_test.write_bytes(TEST_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
args = parser.parse_args()
|
||||||
|
generate_folders(HERE, *(args.numbers or (10, 100)))
|
|
@ -0,0 +1,2 @@
|
||||||
|
def test_x():
|
||||||
|
pass
|
Loading…
Reference in New Issue