-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.py
More file actions
86 lines (73 loc) · 2.45 KB
/
run_tests.py
File metadata and controls
86 lines (73 loc) · 2.45 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
80
81
82
83
84
85
86
#!/usr/bin/env python
"""Script to run all compilation and tests"""
import py_compile
import subprocess
import sys
import os
from pathlib import Path
os.chdir(r"C:\Users\yingjungchen\Downloads\J-browser-agents")
# Step 1: Compile Python files
print("=" * 60)
print("STEP 1: Compiling Python files with py_compile")
print("=" * 60)
files_to_compile = [
"Core/azure_ai_client.py",
"Core/agent_framework.py",
"Core/browser_agent.py",
"Core/text_summarizer.py",
"Core/text_extractor.py",
"Core/browser_automation.py",
]
compile_success = True
for file in files_to_compile:
try:
py_compile.compile(file, doraise=True)
print(f"✓ {file} compiled successfully")
except py_compile.PyCompileError as e:
print(f"✗ {file} compilation failed:")
print(f" {e}")
compile_success = False
if compile_success:
print("\n✓ All Python files compiled successfully!\n")
else:
print("\n✗ Some files failed to compile\n")
sys.exit(1)
# Step 2: Run test_core_imports.py
print("=" * 60)
print("STEP 2: Running test_core_imports.py")
print("=" * 60)
if Path("test_core_imports.py").exists():
result = subprocess.run([sys.executable, "test_core_imports.py"], capture_output=False)
if result.returncode != 0:
print(f"\n✗ test_core_imports.py failed with exit code {result.returncode}\n")
sys.exit(1)
print("\n✓ test_core_imports.py passed!\n")
else:
print("✗ test_core_imports.py not found\n")
# Step 3: Run tests in Tests folder
print("=" * 60)
print("STEP 3: Running tests in Tests folder")
print("=" * 60)
test_files = ["verify_setup.py", "test_quick.py"]
tests_run = False
for test_file in test_files:
test_path = Path("Tests") / test_file
if test_path.exists():
tests_run = True
print(f"\nRunning Tests/{test_file}...")
result = subprocess.run([sys.executable, str(test_path)], capture_output=False)
if result.returncode != 0:
print(f"✗ Tests/{test_file} failed with exit code {result.returncode}\n")
else:
print(f"✓ Tests/{test_file} passed!\n")
if not tests_run:
print("No test files found in Tests folder (verify_setup.py or test_quick.py)\n")
# List what's in Tests folder
tests_dir = Path("Tests")
if tests_dir.exists():
print(f"Files in Tests folder:")
for file in sorted(tests_dir.glob("*.py")):
print(f" - {file.name}")
print("\n" + "=" * 60)
print("All tasks completed!")
print("=" * 60)