Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cover_agent/cover_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def finalize_test_generation(self, iteration_count):
if self.test_validator.current_coverage >= (desired_coverage / 100):
self.logger.info(
f"Reached above target coverage of {desired_coverage}% "
f"(Current Coverage: {current_coverage}%) in {iteration_count} iterations."
f"(Current Coverage: {current_coverage}%) in {iteration_count + 1} iterations."
Copy link
Contributor Author

@andsimakov andsimakov May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a situation where the desired coverage is reached during the first iteration, but it appears as if it was reached in 0 iterations.

)
elif iteration_count == self.config.max_iterations:
coverage_type = "diff coverage" if self.config.diff_coverage else "coverage"
Expand Down
2 changes: 1 addition & 1 deletion cover_agent/lsp_logic/ContextHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from contextlib import asynccontextmanager
from pathlib import Path
from typing import AsyncIterator, List, Tuple, Optional
from cover_agent.AICaller import AICaller
from cover_agent.ai_caller import AICaller
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix after an unintentional rollback.

from cover_agent.lsp_logic.utils.utils_context import (
analyze_context,
find_test_file_context,
Expand Down
6 changes: 6 additions & 0 deletions templated_tests/python_fastapi/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ def test_root():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"message": "Welcome to the FastAPI application!"}


def test_divide_by_zero():
response = client.get("/divide/10/0")
assert response.status_code == 400
assert response.json() == {"detail": "Cannot divide by zero"}
1 change: 1 addition & 0 deletions tests_integration/test_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ sh tests_integration/test_with_docker.sh \
--coverage-type "jacoco" \
--code-coverage-report-path "build/reports/jacoco/test/jacocoTestReport.csv" \
--model $MODEL \
--max-run-time-sec 240 \
$log_db_arg \
$SUPPRESS_LOG_FILES

Expand Down
6 changes: 6 additions & 0 deletions tests_integration/test_with_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ COVERAGE_TYPE="cobertura"
CODE_COVERAGE_REPORT_PATH="coverage.xml"
MAX_ITERATIONS=3 # Default value
DESIRED_COVERAGE=70 # Default value
MAX_RUN_TIME_SEC=30 # Default value
LOG_DB_PATH="${LOG_DB_PATH:-}"
SUPPRESS_LOG_FILES=""

Expand Down Expand Up @@ -46,6 +47,7 @@ while [ "$#" -gt 0 ]; do
--coverage-type) COVERAGE_TYPE="$2"; shift ;;
--code-coverage-report-path) CODE_COVERAGE_REPORT_PATH="$2"; shift ;;
--max-iterations) MAX_ITERATIONS="$2"; shift ;;
--max-run-time-sec) MAX_RUN_TIME_SEC="$2"; shift ;;
--desired-coverage) DESIRED_COVERAGE="$2"; shift ;;
--log-db-path) LOG_DB_PATH="$2"; shift ;;
--suppress-log-files) SUPPRESS_LOG_FILES="--suppress-log-files" ;;
Expand Down Expand Up @@ -115,6 +117,10 @@ COMMAND="/usr/local/bin/cover-agent \
--max-iterations $MAX_ITERATIONS \
--strict-coverage"

if [ -n "$MAX_RUN_TIME_SEC" ]; then
COMMAND="$COMMAND --max-run-time-sec $MAX_RUN_TIME_SEC"
fi

if [ -n "$MODEL" ]; then
COMMAND="$COMMAND --model \"$MODEL\""
fi
Expand Down
Loading