test: improve test coverage from 76% to 88%
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.pytests/test_bad_issue.pytests/test_batch_api_helper.pytests/test_batch_service.pytests/test_batch_client.pytests/test_batch_utils.pytests/test_changes.pytests/test_fetch_script.pytests/test_modes_bad_mrs_batch.pytests/test_modes_batch_mode.pytests/test_modes_compliance_mode.pytests/test_modes_user_profile.pytests/test_profile_service.pytests/test_profile_ui.pytests/test_profile_utils.pytests/test_project_ui.pytests/test_projects.pytests/test_render_user_profile.pytests/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