-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_tests.py
More file actions
74 lines (61 loc) · 2.27 KB
/
Copy pathcheck_tests.py
File metadata and controls
74 lines (61 loc) · 2.27 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python3
"""
Quick test status checker for vocabulary app.
Runs tests and displays summary with color output.
"""
import subprocess
import sys
# ANSI color codes
GREEN = '\033[92m'
RED = '\033[91m'
YELLOW = '\033[93m'
BLUE = '\033[94m'
RESET = '\033[0m'
def run_command(cmd):
"""Run a command and return success status."""
try:
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
return result.returncode == 0, result.stdout, result.stderr
except Exception as e:
return False, "", str(e)
def main():
print(f"\n{BLUE}{'='*60}{RESET}")
print(f"{BLUE}Vocabulary App Test Status{RESET}")
print(f"{BLUE}{'='*60}{RESET}\n")
# Check if pytest is installed
success, _, _ = run_command("pytest --version")
if not success:
print(f"{RED}❌ pytest not installed{RESET}")
print("Install with: pip install -r requirements-dev.txt")
sys.exit(1)
print(f"{GREEN}✓{RESET} pytest is installed\n")
# Run fast tests
print(f"{YELLOW}Running fast tests...{RESET}")
success, stdout, stderr = run_command("pytest -m 'not slow' -v --tb=short")
if success:
print(f"\n{GREEN}✓ All fast tests passed!{RESET}\n")
else:
print(f"\n{RED}✗ Some tests failed{RESET}\n")
print(stdout)
if stderr:
print(stderr)
# Get test count
success, stdout, _ = run_command("pytest --collect-only -q")
if success:
lines = stdout.strip().split('\n')
for line in lines:
if 'test' in line.lower():
print(f"{BLUE}Test count:{RESET} {line}")
# Get coverage if available
print(f"\n{YELLOW}Checking coverage...{RESET}")
success, stdout, _ = run_command("pytest -m 'not slow' --cov=level --cov=google_sheet_io --cov=app --cov-report=term-missing -q")
if success and stdout:
print(stdout)
print(f"\n{BLUE}{'='*60}{RESET}")
print(f"\nFor detailed testing info, see:")
print(f" - {YELLOW}QUICKTEST.md{RESET} - Quick start guide")
print(f" - {YELLOW}TESTING.md{RESET} - Comprehensive documentation")
print(f" - {YELLOW}tests/README.md{RESET} - Test suite details")
print(f"\n{BLUE}{'='*60}{RESET}\n")
if __name__ == "__main__":
main()