Spaces:
Sleeping
Sleeping
| """ | |
| Quick Test - Run all basic tests at once | |
| """ | |
| import subprocess | |
| import sys | |
| def run_test(name, command): | |
| """Run a test and display results""" | |
| print("\n" + "=" * 70) | |
| print(f"π§ͺ TEST: {name}") | |
| print("=" * 70) | |
| try: | |
| result = subprocess.run( | |
| command, | |
| shell=True, | |
| capture_output=True, | |
| text=True, | |
| timeout=30 | |
| ) | |
| print(result.stdout) | |
| if result.stderr: | |
| print("STDERR:", result.stderr) | |
| return result.returncode == 0 | |
| except subprocess.TimeoutExpired: | |
| print("β Test timed out") | |
| return False | |
| except Exception as e: | |
| print(f"β Error: {e}") | |
| return False | |
| def main(): | |
| print(""" | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β SMART PARKING SYSTEM - QUICK TEST SUITE β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| """) | |
| tests = [ | |
| ("Database Slot Check", "python check_slots.py"), | |
| ("Full Database Integration", "python test_database.py"), | |
| ] | |
| results = {} | |
| for name, command in tests: | |
| results[name] = run_test(name, command) | |
| # Summary | |
| print("\n" + "=" * 70) | |
| print("π TEST SUMMARY") | |
| print("=" * 70) | |
| for name, passed in results.items(): | |
| status = "β PASSED" if passed else "β FAILED" | |
| print(f"{status}: {name}") | |
| total = len(results) | |
| passed = sum(1 for v in results.values() if v) | |
| print(f"\n Total: {passed}/{total} tests passed") | |
| if passed == total: | |
| print("\nπ All tests passed!") | |
| else: | |
| print("\nβ οΈ Some tests failed. Check the output above.") | |
| print("\nπ‘ To start the API server, run:") | |
| print(" python backend/main.py") | |
| print("\nπ‘ Then visit http://127.0.0.1:8000/docs for interactive API testing") | |
| if __name__ == "__main__": | |
| main() | |