Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /DansiDanutz_MyWork-AI /find_hanging_tests.py
| #!/usr/bin/env python3 | |
| """Find hanging tests by running each one individually.""" | |
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| import glob | |
| import time | |
| def test_file(test_file): | |
| """Test a single file with timeout.""" | |
| print(f"Testing {test_file}...", end=" ", flush=True) | |
| try: | |
| start = time.time() | |
| result = subprocess.run( | |
| [sys.executable, "-m", "pytest", test_file, "-q", "--tb=short", "--timeout=5"], | |
| capture_output=True, | |
| text=True, | |
| timeout=10, # Hard timeout | |
| cwd="/home/Memo1981/MyWork-AI" | |
| ) | |
| duration = time.time() - start | |
| if result.returncode == 0: | |
| print(f"โ PASS ({duration:.1f}s)") | |
| return "pass" | |
| else: | |
| print(f"โ FAIL ({duration:.1f}s)") | |
| return "fail" | |
| except subprocess.TimeoutExpired: | |
| print(f"๐ฅ HANG (>10s)") | |
| return "hang" | |
| except Exception as e: | |
| print(f"๐ฅ ERROR: {e}") | |
| return "error" | |
| if __name__ == "__main__": | |
| test_files = sorted(glob.glob("/home/Memo1981/MyWork-AI/tests/test_*.py")) | |
| passed = [] | |
| failed = [] | |
| hanging = [] | |
| errors = [] | |
| for test_file_path in test_files: | |
| result = test_file(test_file_path) | |
| if result == "pass": | |
| passed.append(test_file) | |
| elif result == "fail": | |
| failed.append(test_file) | |
| elif result == "hang": | |
| hanging.append(test_file) | |
| else: | |
| errors.append(test_file) | |
| print(f"\n๐ RESULTS:") | |
| print(f"โ Passed: {len(passed)}") | |
| print(f"โ Failed: {len(failed)}") | |
| print(f"๐ฅ Hanging: {len(hanging)}") | |
| print(f"๐ฅ Errors: {len(errors)}") | |
| if hanging: | |
| print(f"\n๐ฅ Hanging tests to remove:") | |
| for test in hanging: | |
| print(f" {Path(test).name}") |
Xet Storage Details
- Size:
- 1.91 kB
- Xet hash:
- 8049d140f79fb1cb455fcb81ddc73d306e2fdba926d2760595b6df473a49c78a
ยท
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.