diff --git a/.coveragerc b/.coveragerc index fd4586d..0eabdcd 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,8 +1,5 @@ [run] source = src.cli_code -include = - */src/cli_code/tools/test_runner.py - */src/cli_code/models/gemini.py omit = */.rules/* */.venv/* diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 5bf4202..89526fc 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -87,19 +87,19 @@ jobs: run: | # Set CI variables export CI_TEST_TIMEOUT=120 - export CI_EXIT_ON_TEST_FAILURE=0 + export CI_EXIT_ON_TEST_FAILURE=1 # Run directly without using bash to make error handling clearer bash -ex ./scripts/run_coverage_ci.sh || echo "Coverage generation had errors but we'll continue" - # Generate dummy coverage if needed - if [ ! -f "coverage.xml" ]; then - echo "Creating placeholder coverage.xml file" - echo '/Users/runner/work/cli-code/cli-code/src' > coverage.xml + # Extract actual coverage percentage from XML file + if [ -f "coverage.xml" ]; then + COVERAGE=$(python -c "import xml.etree.ElementTree as ET; tree = ET.parse('coverage.xml'); root = tree.getroot(); line_rate = float(root.attrib['line-rate'])*100; print('{:.2f}%'.format(line_rate))") + echo "percentage=$COVERAGE" >> $GITHUB_OUTPUT + else + echo "Warning: No coverage.xml file was generated" + echo "percentage=0.00%" >> $GITHUB_OUTPUT fi - - # Set a fixed coverage percentage for PR comment - echo "percentage=85.00%" >> $GITHUB_OUTPUT - name: Comment PR with code coverage if: github.event_name == 'pull_request' diff --git a/pr_description.md b/pr_description.md deleted file mode 100644 index 5833d7a..0000000 --- a/pr_description.md +++ /dev/null @@ -1,23 +0,0 @@ -## Overview -This PR fixes the code coverage regression by updating the import statements in test files and using improved test versions. - -## Changes -- Updated import statements in test files to use direct imports from `src.cli_code` instead of `cli_code` to ensure proper coverage tracking -- Updated test scripts to use the improved test files from the `test_dir/improved` directory -- Added BaseTool tests in coverage scripts to improve coverage of the base tool class -- Fixed failing assertions in the Gemini model tests -- Updated tools coverage script to include all the necessary tool tests - -## Test Results -- Tools coverage increased to 95.26% overall -- Individual components show excellent coverage: - - 100% coverage for directory_tools, quality_tools, task_complete_tool, and test_runner - - 98.65% coverage for summarizer_tool - - 96.70% coverage for tree_tool - - 89.83% coverage for file_tools - - 87.50% coverage for base tool class - -## Why It's Needed -The code coverage had regressed due to import paths not being correctly set for coverage tracking. These changes restore and improve the coverage levels while ensuring all tests pass reliably. - -Fixes the coverage regression issues previously identified. \ No newline at end of file diff --git a/scripts/run_coverage_ci.sh b/scripts/run_coverage_ci.sh index 0ef9bd0..0368a1e 100755 --- a/scripts/run_coverage_ci.sh +++ b/scripts/run_coverage_ci.sh @@ -10,7 +10,7 @@ echo "Starting coverage generation for CI..." mkdir -p coverage_html # Set environment variables for CI -export CI_EXIT_ON_TEST_FAILURE=0 # Don't exit on test failures in CI +export CI_EXIT_ON_TEST_FAILURE=1 # Exit on test failures to ensure code quality export CI_TEST_TIMEOUT=60 # Default timeout # Special handling for GitHub Actions environment