Skip to content

Commit 332b741

Browse files
Create prepare_tests.py
Co-authored-by: LeAndre <lcjunior1220@gmail.com>
1 parent a11241f commit 332b741

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

scripts/prepare_tests.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import os
2+
import shutil
3+
import sys
4+
5+
args = sys.argv[1:]
6+
copied = []
7+
8+
def copy_file(src):
9+
base = os.path.basename(src)
10+
new = f"test_{base}"
11+
shutil.copy(src, new)
12+
copied.append(new)
13+
print(f"[tox] Copied: {src}{new}")
14+
15+
def walk_dir(path):
16+
for root, _, files in os.walk(path):
17+
for f in files:
18+
if f.endswith(".py"):
19+
copy_file(os.path.join(root, f))
20+
21+
if not args:
22+
print("[tox] No files or directories passed — using pytest auto-discovery.")
23+
else:
24+
for path in args:
25+
if os.path.isdir(path):
26+
print(f"[tox] Recursively scanning directory: {path}")
27+
walk_dir(path)
28+
elif os.path.isfile(path):
29+
copy_file(path)
30+
else:
31+
print(f"[tox] Warning: {path} does not exist and will be ignored.")
32+
33+
with open(".tox_copied_files", "w") as f:
34+
for name in copied:
35+
f.write(name + "\n")

0 commit comments

Comments
 (0)