Skip to content

test: improve test coverage from 76% to 88%

Suma Pullaiahgari requested to merge tests/coverage-improvements into feature-final

What does this MR do and why?

This MR improves the overall test coverage of the project from approximately 76% to 88%.

The goal is to increase confidence in the codebase by adding missing tests and covering previously untested or partially tested modules.


Key Improvements

  • Added comprehensive tests across multiple modules:

    • Projects/*
    • user_profile/*
    • modes/*
    • batch_mode/*
  • Introduced tests for previously untested components

  • Improved coverage for:

    • async workflows
    • batch processing
    • UI-related logic
  • Added edge case and error-handling scenarios

  • Minor refactoring was performed in some source files to improve testability (no business logic changes)


Coverage Summary

  • Before: ~76%
  • After: 88%

Test Files Added / Updated

  • tests/test_app.py
  • tests/test_bad_issue.py
  • tests/test_batch_api_helper.py
  • tests/test_batch_service.py
  • tests/test_batch_client.py
  • tests/test_batch_utils.py
  • tests/test_changes.py
  • tests/test_fetch_script.py
  • tests/test_modes_bad_mrs_batch.py
  • tests/test_modes_batch_mode.py
  • tests/test_modes_compliance_mode.py
  • tests/test_modes_user_profile.py
  • tests/test_profile_service.py
  • tests/test_profile_ui.py
  • tests/test_profile_utils.py
  • tests/test_project_ui.py
  • tests/test_projects.py
  • tests/test_render_user_profile.py
  • tests/test_repro_timeout_v3.py

Notes

  • Some tests related to export functionality are conditionally skipped due to optional dependencies (openpyxl/xlsxwriter)
  • Coverage improvements focus on meaningful test cases, not just execution coverage

Remaining Work (Follow-up)

The following modules still require additional coverage:

  • gitlab_utils/client.py (~38%)
  • modes/team_leaderboard.py (~36%)
  • modes/compliance_mode.py (~75%)
  • batch_mode/export_service.py (~70%)
  • modes/bad_mrs_batch.py (~55%)
  • modes/bad_issue.py (~61%)

How to validate locally

pip install -r requirements.txt
pytest --cov

Expected result:

  • ~88% total coverage

MR acceptance checklist

  • Tests added for uncovered modules
  • Coverage improved from 76% → 88%
  • No breaking changes
  • Minor refactoring only for testability
  • Known gaps documented
Edited by Suma Pullaiahgari

Merge request reports

Loading