Test/improve coverage
Here’s a clean MR description based on your work (pytest + increasing coverage)
What does this MR do and why?
This Merge Request adds comprehensive unit test cases using pytest for the gitlab_utils modules to improve overall test coverage.
Currently, the project has very low test coverage (~18%), with several modules like client.py, commits.py, issues.py, and merge_requests.py not covered. This MR addresses that by adding test cases for uncovered functions, handling different scenarios such as successful responses, failures, and edge cases.
The goal is to improve code reliability, maintainability, and meet compliance requirements by moving towards 100% test coverage.
References
- Issue: #
Screenshots or screen recordings
| Before | After |
|---|---|
| Coverage: 18% | Coverage: (updated % after tests) |
How to set up and validate locally
-
Clone the repository:
git clone <repo-url> cd gitlab-compliance-checker -
Create and activate virtual environment:
python3 -m venv venv source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt -
Run tests with coverage:
pytest --cov=gitlab_utils --cov-report=term -
Verify:
- All tests pass
✅ - Coverage percentage is increased significantly
- All tests pass
MR acceptance checklist
-
Added unit test cases for uncovered modules -
Covered success, failure, and edge cases -
Mocked external API calls where required -
All tests are passing -
Coverage improved significantly -
Code follows project structure and standards