@@ -9,14 +9,18 @@ PIP := $(VENV_DIR)/bin/pip
99.PHONY : help
1010help :
1111 @echo " Available targets:"
12- @echo " all - Install dependencies and run tests"
13- @echo " venv - Create a virtual environment"
14- @echo " install - Install Python dependencies"
15- @echo " lint - Run Black code formatting"
16- @echo " test - Run tests"
17- @echo " docker-build - Build the Docker image"
18- @echo " docker-run - Run the Docker container with the example"
19- @echo " visualizer - Run the visualization script"
12+ @echo " all - Install dependencies and run unit tests"
13+ @echo " venv - Create a virtual environment"
14+ @echo " install - Install Python dependencies"
15+ @echo " install-dev - Install development dependencies including optillm"
16+ @echo " lint - Run Black code formatting"
17+ @echo " test - Run unit tests only"
18+ @echo " test-unit - Run unit tests only (same as test)"
19+ @echo " test-integration - Run integration tests with local LLM"
20+ @echo " test-all - Run both unit and integration tests"
21+ @echo " docker-build - Build the Docker image"
22+ @echo " docker-run - Run the Docker container with the example"
23+ @echo " visualizer - Run the visualization script"
2024
2125.PHONY : all
2226all : install test
@@ -31,16 +35,55 @@ venv:
3135install : venv
3236 $(PIP ) install -e .
3337
38+ # Install development dependencies including optillm for integration tests
39+ .PHONY : install-dev
40+ install-dev : venv
41+ $(PIP ) install -e .
42+ $(PIP ) install pytest optillm
43+
3444# Run Black code formatting
3545.PHONY : lint
3646lint : venv
3747 $(PYTHON ) -m black openevolve examples tests scripts
3848
39- # Run tests using the virtual environment
49+ # Run unit tests only (fast, no LLM required)
4050.PHONY : test
4151test : venv
4252 $(PYTHON ) -m unittest discover -s tests -p " test_*.py"
4353
54+ # Alias for test
55+ .PHONY : test-unit
56+ test-unit : test
57+
58+ # Run integration tests with local LLM (requires optillm)
59+ .PHONY : test-integration
60+ test-integration : install-dev
61+ @echo " Starting optillm server for integration tests..."
62+ @OPTILLM_API_KEY=optillm $(VENV_DIR ) /bin/optillm --model google/gemma-3-270m-it --port 8000 &
63+ @OPTILLM_PID=$$ ! && \
64+ echo $$ OPTILLM_PID > /tmp/optillm.pid && \
65+ echo " Waiting for optillm server to start..." && \
66+ sleep 10 && \
67+ echo " Running integration tests..." && \
68+ OPENAI_API_KEY=optillm $(PYTHON ) -m pytest tests/integration -v --tb=short; \
69+ TEST_EXIT_CODE=$$? ; \
70+ echo " Stopping optillm server..." ; \
71+ kill $$ OPTILLM_PID 2> /dev/null || true ; \
72+ pkill -f " optillm.*8000" 2> /dev/null || true ; \
73+ rm -f /tmp/optillm.pid; \
74+ exit $$ TEST_EXIT_CODE
75+
76+ # Run integration tests with existing optillm server (for development)
77+ .PHONY : test-integration-dev
78+ test-integration-dev : venv
79+ @echo " Using existing optillm server at localhost:8000"
80+ @curl -s http://localhost:8000/health > /dev/null || (echo " Error: optillm server not running at localhost:8000" && exit 1)
81+ OPENAI_API_KEY=optillm $(PYTHON ) -m pytest tests/integration -v
82+
83+ # Run all tests (unit first, then integration)
84+ .PHONY : test-all
85+ test-all : test test-integration
86+
4487# Build the Docker image
4588.PHONY : docker-build
4689docker-build :
0 commit comments