-
Notifications
You must be signed in to change notification settings - Fork 266
Expand file tree
/
Copy pathtest_ci_quick.py
More file actions
81 lines (70 loc) · 3.02 KB
/
test_ci_quick.py
File metadata and controls
81 lines (70 loc) · 3.02 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
#!/usr/bin/env python3
"""
Quick CI test to verify basic functionality
"""
import time
import sys
import os
start_time = time.time()
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Import key modules to ensure they load
try:
from optillm import parse_combined_approach, execute_single_approach, plugin_approaches
print("✅ Core optillm module imported successfully")
except Exception as e:
print(f"❌ Failed to import core modules: {e}")
sys.exit(1)
# Test importing approach modules
try:
from optillm.mcts import chat_with_mcts
from optillm.bon import best_of_n_sampling
from optillm.moa import mixture_of_agents
print("✅ Approach modules imported successfully")
except Exception as e:
print(f"❌ Failed to import approach modules: {e}")
# Test plugin existence
try:
import optillm.plugins.memory_plugin
import optillm.plugins.readurls_plugin
import optillm.plugins.privacy_plugin
import optillm.plugins.genselect_plugin
import optillm.plugins.majority_voting_plugin
print("✅ Basic plugin modules exist and can be imported")
except Exception as e:
print(f"❌ Basic plugin import test failed: {e}")
# Test plugin subdirectory imports (critical for issue #220)
try:
from optillm.plugins.deepthink import SelfDiscover, UncertaintyRoutedCoT
from optillm.plugins.deep_research import DeepResearcher
from optillm.plugins.longcepo import run_longcepo
from optillm.plugins.spl import run_spl
from optillm.plugins.proxy import client, config, approach_handler
print("✅ Plugin submodule imports working - no relative import errors")
except ImportError as e:
if "attempted relative import" in str(e):
print(f"❌ Critical: Relative import error detected: {e}")
sys.exit(1)
else:
print(f"❌ Plugin submodule import error: {e}")
except Exception as e:
print(f"❌ Plugin submodule import error: {e}")
# Test approach parsing
try:
# Define known approaches for testing
known_approaches = ["moa", "bon", "mcts", "cot_reflection"]
plugin_approaches_test = {"memory": True, "readurls": True}
test_cases = [
("moa-gpt-4", "SINGLE", ["moa"], "gpt-4"),
("bon|moa|mcts-gpt-4", "OR", ["bon", "moa", "mcts"], "gpt-4"),
("memory&moa-gpt-4", "AND", ["memory", "moa"], "gpt-4"),
]
for combined, expected_op, expected_approaches, expected_model in test_cases:
operation, approaches, model = parse_combined_approach(combined, known_approaches, plugin_approaches_test)
assert operation == expected_op, f"Expected operation {expected_op}, got {operation}"
assert approaches == expected_approaches, f"Expected {expected_approaches}, got {approaches}"
assert model == expected_model, f"Expected {expected_model}, got {model}"
print("✅ Approach parsing tests passed")
except Exception as e:
print(f"❌ Approach parsing test failed: {e}")
print(f"\n✅ All CI quick tests completed!")
print(f"Total test time: {time.time() - start_time:.2f}s")