Skip to content

Commit 88351c9

Browse files
committed
fix tests
1 parent 4f8ff58 commit 88351c9

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

tests/test_island_isolation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ def test_island_isolation_during_evolution(self):
9999
# Track which islands were sampled
100100
sampled_islands = []
101101

102-
def mock_sample(num_inspirations=None):
103-
# Record which island was sampled
104-
sampled_islands.append(self.database.current_island)
102+
def mock_sample_from_island(island_id, num_inspirations=None):
103+
# Record which island was sampled (using the island_id parameter)
104+
sampled_islands.append(island_id)
105105
# Return mock parent and inspirations
106106
mock_program = Program(id="mock", code="", metrics={})
107107
return mock_program, []
108108

109-
with patch.object(self.database, "sample", side_effect=mock_sample):
109+
with patch.object(self.database, "sample_from_island", side_effect=mock_sample_from_island):
110110
with patch.object(controller, "executor"):
111111
# Submit iterations for different islands
112112
controller._submit_iteration(1, island_id=0)

tests/test_utils.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ def start_test_server(model: str = TEST_MODEL, port: Optional[int] = None) -> Tu
5555

5656
print(f"Starting optillm server on port {port}...")
5757

58-
# Start server
58+
# Start server (don't capture output to avoid pipe buffer deadlock)
5959
proc = subprocess.Popen([
6060
"optillm",
6161
"--model", model,
6262
"--port", str(port)
63-
], env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
63+
], env=env)
6464

6565
# Wait for server to start
6666
for i in range(30):
@@ -75,18 +75,9 @@ def start_test_server(model: str = TEST_MODEL, port: Optional[int] = None) -> Tu
7575
pass
7676
time.sleep(1)
7777

78-
# Server didn't start in time - collect error info
79-
try:
80-
stdout, stderr = proc.communicate(timeout=2)
81-
error_msg = f"optillm server failed to start on port {port}"
82-
if stdout:
83-
error_msg += f"\nSTDOUT: {stdout[:500]}"
84-
if stderr:
85-
error_msg += f"\nSTDERR: {stderr[:500]}"
86-
except subprocess.TimeoutExpired:
87-
proc.kill()
88-
stdout, stderr = proc.communicate()
89-
error_msg = f"optillm server failed to start on port {port} (timeout)"
78+
# Server didn't start in time - clean up
79+
error_msg = f"optillm server failed to start on port {port}"
80+
print(f"❌ {error_msg} - check that optillm is installed and model is available")
9081

9182
# Clean up
9283
try:

0 commit comments

Comments
 (0)