From f3087492f53f40fb4b99d837a63cf9324df1a0fe Mon Sep 17 00:00:00 2001 From: Ed_ Date: Wed, 13 May 2026 23:53:04 -0400 Subject: [PATCH] run tests batched script --- scripts/run_tests_batched.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 scripts/run_tests_batched.py diff --git a/scripts/run_tests_batched.py b/scripts/run_tests_batched.py new file mode 100644 index 0000000..6160d0a --- /dev/null +++ b/scripts/run_tests_batched.py @@ -0,0 +1,36 @@ +import os +import subprocess +import sys + +def run_tests(): + test_dir = "tests" + test_files = [f for f in os.listdir(test_dir) if f.startswith("test_") and f.endswith(".py")] + test_files.sort() + + batch_size = 4 + all_failed = [] + + print(f"Starting test execution of {len(test_files)} files in batches of {batch_size}...") + + for i in range(0, len(test_files), batch_size): + batch = test_files[i:i + batch_size] + cmd = ["uv", "run", "pytest", "--maxfail=10"] + [os.path.join(test_dir, f) for f in batch] + print(f"\nBatch {i//batch_size + 1}: {' '.join(batch)}") + try: + subprocess.run(cmd, check=True) + except subprocess.CalledProcessError: + print(f"Batch {i//batch_size + 1} failed.") + all_failed.extend(batch) + + if all_failed: + print("\n" + "="*30) + print(f"Total batches with failures: {len(all_failed)//batch_size + 1 if len(all_failed)%batch_size else len(all_failed)//batch_size}") + print("Files in failed batches:") + for f in all_failed: + print(f" - {f}") + print("="*30) + else: + print("\nAll batches passed successfully!") + +if __name__ == "__main__": + run_tests()