-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathcomprehensive_test.py
More file actions
79 lines (61 loc) · 2.33 KB
/
comprehensive_test.py
File metadata and controls
79 lines (61 loc) · 2.33 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
75
76
77
78
79
#!/usr/bin/env python3
import subprocess
import sys
import os
def run_command(cmd, description):
"""Run a command and report results"""
print(f"\n=== {description} ===")
print(f"Running: {cmd}")
try:
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, cwd='/workspace')
if result.returncode == 0:
print(f"✓ {description}: PASS")
if result.stdout:
print("Output:", result.stdout[:200] + "..." if len(result.stdout) > 200 else result.stdout)
else:
print(f"✗ {description}: FAIL")
print("Error:", result.stderr[:200] + "..." if len(result.stderr) > 200 else result.stderr)
return result.returncode == 0
except Exception as e:
print(f"✗ {description}: ERROR - {e}")
return False
def main():
print("=== Testing PF Tasks (Direct Commands) ===")
# Change to workspace directory
os.chdir('/workspace')
# Test basic Python functionality
success_count = 0
total_tests = 0
# Test 1: Basic import
total_tests += 1
if run_command("python3 -c 'import cdp; print(cdp.accessibility)'", "Basic CDP Import"):
success_count += 1
# Test 2: Generator tests
total_tests += 1
if run_command("python3 -m pytest generator/ -v", "Generator Tests"):
success_count += 1
# Test 3: CDP tests
total_tests += 1
if run_command("python3 -m pytest test/ -v", "CDP Tests"):
success_count += 1
# Test 4: Code generation
total_tests += 1
if run_command("python3 generator/generate.py", "Code Generation"):
success_count += 1
# Test 5: MyPy on generator
total_tests += 1
if run_command("python3 -m mypy generator/", "MyPy Generator"):
success_count += 1
# Test 6: MyPy on CDP
total_tests += 1
if run_command("python3 -m mypy cdp/", "MyPy CDP"):
success_count += 1
print(f"\n=== Test Summary ===")
print(f"Passed: {success_count}/{total_tests}")
print(f"Failed: {total_tests - success_count}/{total_tests}")
if success_count == total_tests:
print("✓ All pf tasks are working correctly!")
else:
print("✗ Some pf tasks have issues that need to be addressed.")
if __name__ == "__main__":
main()