-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests_with_coverage.py
More file actions
40 lines (36 loc) · 1.13 KB
/
run_tests_with_coverage.py
File metadata and controls
40 lines (36 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
"""
Script per eseguire i test con coverage.
Uso: python run_tests_with_coverage.py
"""
import subprocess
import sys
def run_tests_with_coverage():
"""Esegue i test con coverage completo."""
cmd = [
sys.executable, "-m", "pytest",
"--cov=ohlcv_to_orderbook",
"--cov-report=term-missing",
"--cov-report=html:htmlcov",
"--cov-report=xml:coverage.xml",
"--cov-fail-under=80",
"--cov-branch",
"tests/"
]
print("🧪 Eseguendo test con coverage...")
print(f"Comando: {' '.join(cmd)}")
print("-" * 50)
try:
result = subprocess.run(cmd, check=False)
if result.returncode == 0:
print("\n✅ Test completati con successo!")
print("📊 Report coverage disponibile in htmlcov/index.html")
else:
print("\n❌ Alcuni test sono falliti o coverage insufficiente")
return result.returncode
except Exception as e:
print(f"\n💥 Errore durante l'esecuzione: {e}")
return 1
if __name__ == "__main__":
exit_code = run_tests_with_coverage()
sys.exit(exit_code)