Run a single test file and return success status.
(test_file)
| 16 | sys.path.insert(0, str(project_root)) |
| 17 | |
| 18 | def run_test_file(test_file): |
| 19 | """Run a single test file and return success status.""" |
| 20 | print(f"\n🧪 Running {test_file}...") |
| 21 | try: |
| 22 | result = subprocess.run([sys.executable, str(test_file)], |
| 23 | capture_output=True, text=True, cwd=project_root) |
| 24 | |
| 25 | if result.returncode == 0: |
| 26 | print(f"✅ {test_file.name} - PASSED") |
| 27 | if result.stdout: |
| 28 | print(f"📄 Output:\n{result.stdout}") |
| 29 | return True |
| 30 | else: |
| 31 | print(f"❌ {test_file.name} - FAILED") |
| 32 | if result.stderr: |
| 33 | print(f"💥 Error:\n{result.stderr}") |
| 34 | if result.stdout: |
| 35 | print(f"📄 Output:\n{result.stdout}") |
| 36 | return False |
| 37 | except Exception as e: |
| 38 | print(f"💥 {test_file.name} - ERROR: {e}") |
| 39 | return False |
| 40 | |
| 41 | def run_tests(test_dirs): |
| 42 | """Run all tests in the specified directories.""" |