Skip to content

Commit 2021d0b

Browse files
committed
skip slow tess
1 parent 88e6908 commit 2021d0b

File tree

10 files changed

+428
-8
lines changed

10 files changed

+428
-8
lines changed

.github/workflows/python-test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,14 @@ jobs:
7777
OPTILLM_API_KEY: optillm
7878
HF_TOKEN: ${{ secrets.HF_TOKEN }}
7979

80-
- name: Run integration tests
80+
- name: Run integration tests (excluding slow tests)
8181
env:
8282
OPENAI_API_KEY: optillm
8383
OPTILLM_API_KEY: optillm
8484
HF_TOKEN: ${{ secrets.HF_TOKEN }}
8585
run: |
86-
pytest tests/integration -v --tb=short
86+
# Run only fast integration tests, skip slow tests that require real LLM
87+
pytest tests/integration -v --tb=short -m "not slow"
8788
8889
- name: Stop optillm server
8990
if: always()

openevolve/llm/openai.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ def __init__(
3535
self.random_seed = getattr(model_cfg, "random_seed", None)
3636

3737
# Set up API client
38+
# OpenAI client requires max_retries to be int, not None
39+
max_retries = self.retries if self.retries is not None else 0
3840
self.client = openai.OpenAI(
3941
api_key=self.api_key,
4042
base_url=self.api_base,
4143
timeout=self.timeout,
42-
max_retries=self.retries,
44+
max_retries=max_retries,
4345
)
4446

4547
# Only log unique models to reduce duplication

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ disallow_incomplete_defs = true
4949
[project.scripts]
5050
openevolve-run = "openevolve.cli:main"
5151

52+
[tool.pytest.ini_options]
53+
markers = [
54+
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
55+
"integration: marks tests as integration tests requiring external services"
56+
]
57+
addopts = "--strict-markers"
58+
5259
[tool.setuptools.packages.find]
5360
include = ["openevolve*"]
5461

tests/integration/test_checkpoint_with_llm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
class TestCheckpointWithLLM:
1111
"""Test checkpoints with real LLM generation"""
1212

13+
@pytest.mark.slow
1314
@pytest.mark.asyncio
1415
async def test_checkpoint_intervals_with_real_llm(
1516
self,
@@ -52,6 +53,7 @@ async def test_checkpoint_intervals_with_real_llm(
5253
if len(controller.database.programs) > 1: # More than just initial program
5354
assert len(checkpoint_calls) > 0, "Should have at least one checkpoint call if evolution succeeded"
5455

56+
@pytest.mark.slow
5557
@pytest.mark.asyncio
5658
async def test_checkpoint_resume_functionality(
5759
self,
@@ -94,6 +96,7 @@ async def test_checkpoint_resume_functionality(
9496
else:
9597
print("No checkpoints directory created")
9698

99+
@pytest.mark.slow
97100
@pytest.mark.asyncio
98101
async def test_final_checkpoint_creation(
99102
self,
@@ -127,6 +130,7 @@ async def test_final_checkpoint_creation(
127130
# This depends on the controller logic, so we just verify the system didn't crash
128131
assert len(controller.database.programs) >= 1, "Should have at least the initial program"
129132

133+
@pytest.mark.slow
130134
@pytest.mark.asyncio
131135
async def test_checkpoint_with_best_program_save(
132136
self,

tests/integration/test_evolution_pipeline.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
class TestEvolutionPipeline:
1111
"""Test complete evolution with real LLM generation"""
1212

13+
@pytest.mark.slow
1314
@pytest.mark.asyncio
1415
async def test_full_evolution_loop(
1516
self,
@@ -61,6 +62,7 @@ async def test_full_evolution_loop(
6162
populated_islands = [i for i, count in island_counts.items() if count > 0]
6263
assert len(populated_islands) >= 1, "At least one island should have programs"
6364

65+
@pytest.mark.slow
6466
@pytest.mark.asyncio
6567
async def test_island_feature_maps_populated(
6668
self,
@@ -98,6 +100,7 @@ async def test_island_feature_maps_populated(
98100
assert program_id in controller.database.programs, \
99101
f"Program {program_id} in island {island_idx} feature map not found in database"
100102

103+
@pytest.mark.slow
101104
@pytest.mark.asyncio
102105
async def test_evolution_with_small_model_succeeds(
103106
self,
@@ -134,6 +137,7 @@ async def test_evolution_with_small_model_succeeds(
134137
# It's okay if no log files - depends on config
135138
print(f"Found {len(log_files)} log files")
136139

140+
@pytest.mark.slow
137141
@pytest.mark.asyncio
138142
async def test_best_program_tracking(
139143
self,

tests/integration/test_library_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def _get_library_test_config(port: int = 8000) -> Config:
4343
class TestLibraryAPIIntegration:
4444
"""Test OpenEvolve library API with real LLM integration"""
4545

46+
@pytest.mark.slow
4647
def test_evolve_function_real_integration(
4748
self,
4849
optillm_server,
@@ -100,6 +101,7 @@ def simple_multiply(x, y):
100101
print(f" Output dir: {result.output_dir}")
101102
print(f" Code length: {len(result.best_code)} chars")
102103

104+
@pytest.mark.slow
103105
def test_evolve_code_real_integration(
104106
self,
105107
optillm_server,
@@ -185,6 +187,7 @@ def fibonacci_evaluator(program_path):
185187
print(f" Best score: {result.best_score}")
186188
print(f" Output dir: {result.output_dir}")
187189

190+
@pytest.mark.slow
188191
def test_run_evolution_real_integration(
189192
self,
190193
optillm_server,

tests/integration/test_migration_with_llm.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
class TestMigrationWithLLM:
1111
"""Test island migration with real LLM generation"""
1212

13+
@pytest.mark.slow
1314
@pytest.mark.asyncio
1415
async def test_island_migration_no_duplicates_real_evolution(
1516
self,
@@ -70,6 +71,7 @@ async def test_island_migration_no_duplicates_real_evolution(
7071
assert "_migrant" not in migrant.id, \
7172
f"Migrant program {migrant.id} has _migrant suffix"
7273

74+
@pytest.mark.slow
7375
@pytest.mark.asyncio
7476
async def test_per_island_map_elites_isolation(
7577
self,
@@ -112,6 +114,7 @@ async def test_per_island_map_elites_isolation(
112114
assert program_island == island_idx, \
113115
f"Program {program_id} island mismatch: in map {island_idx} but metadata says {program_island}"
114116

117+
@pytest.mark.slow
115118
@pytest.mark.asyncio
116119
async def test_migration_preserves_program_quality(
117120
self,
@@ -162,6 +165,7 @@ async def test_migration_preserves_program_quality(
162165
# Most importantly: no _migrant_ suffix
163166
assert "_migrant" not in migrant.id, f"Migrant {migrant.id} should not have _migrant suffix"
164167

168+
@pytest.mark.slow
165169
@pytest.mark.asyncio
166170
async def test_migration_timing_logic(
167171
self,
@@ -206,6 +210,7 @@ async def test_migration_timing_logic(
206210
# but the system should have at least considered it
207211
print(f"Migration should have been considered (max gen: {max_generation})")
208212

213+
@pytest.mark.slow
209214
@pytest.mark.asyncio
210215
async def test_single_island_no_migration(
211216
self,

0 commit comments

Comments
 (0)