test: add 100% coverage tests for user_profile modules
What does this MR do and why?
This MR adds 100% test coverage for the user_profile module and improves overall test reliability.
📦 Coverage Improvements
Comprehensive unit tests have been added for the following modules:
| File | Statements | Tests Added |
|---|---|---|
user_profile/profile_service.py |
140 | 56 tests |
user_profile/profile_ui.py |
96 | 22 tests |
user_profile/profile_utils.py |
58 | 6 tests (updated) |
user_profile/render_user_profile.py |
52 | 9 tests |
➕ Test Files Added (7 total)
tests/test_profile_service.pytests/test_profile_ui.pytests/test_profile_utils.pytests/test_render_user_profile.pytests/test_batch_utils.pytests/test_asyncio_patch.pytests/test_asyncio_patch_2.py
🔧 Additional Changes
- Fixed mock decorator in
test_batch_utils.pyto supportttlargument - Updated
pyproject.tomlto excludevenv,.venv,build, anddistfrom Vulture checks - Updated
mypy.inito ignore missing imports for external dependencies
📊 Summary
- Total test files: 7
- Total tests added: 108+
-
Coverage achieved: 100% for
user_profilemodule - Improves reliability and prevents regressions
References
- Addresses test coverage gaps identified in code quality checks
- Part of testing improvements for compliance checker module
Screenshots or screen recordings
| Before | After |
|---|---|
| Partial coverage | 100% coverage |
How to set up and validate locally
- Run all tests:
./venv/bin/python -m pytest tests/ -v
- Verify coverage:
./venv/bin/python -m pytest tests/ \
--cov=user_profile.profile_service \
--cov=user_profile.profile_ui \
--cov=user_profile.profile_utils \
--cov=user_profile.render_user_profile \
--cov-report=term-missing
- Run full suite:
./venv/bin/python -m pytest tests/ -q
MR acceptance checklist
-
Tests added for all new code paths -
All existing tests pass -
Code coverage at 100% for modified files -
No breaking changes to existing functionality -
Follows project testing conventions -
Documentation updated (if applicable) -
No security issues introduced -
No performance degradation
Edited by Suma Pullaiahgari