Enhance test coverage and refactor code in various modules

- Achieved 85% overall test coverage with detailed results for individual components.
- Added unit tests for DragInterceptor and MainWindow components.
- Refactored imports and removed unused code in multiple files.
- Updated test configurations and ensured compliance with coverage standards.
This commit is contained in:
claudi 2026-01-28 11:51:59 +01:00
parent 736b80b8f1
commit dbf8f2b92f
10 changed files with 793 additions and 18 deletions

View file

@ -491,10 +491,20 @@ if __name__ == "__main__":
**Files to create/extend:**
- [x] `tests/unit/test_config.py` - Complete
- [x] `tests/unit/test_validator.py` - Complete
- [ ] `tests/unit/test_drag_interceptor.py`
- [ ] `tests/unit/test_main_window.py`
- [x] `tests/unit/test_drag_interceptor.py` - 25 tests (96% coverage)
- [x] `tests/unit/test_main_window.py` - 38 tests (88% coverage)
**Target Coverage**: 80%+ line coverage
**Target Coverage**: 80%+ line coverage ✅ ACHIEVED (85% overall)
**Test Suite Results:**
- **Total Tests**: 99 passing
- **Overall Coverage**: 85%
- Config: 95%
- DragInterceptor: 96%
- Validator: 94%
- MainWindow: 88%
- RestrictedWebEngineView: 95%
- Logging: 100%
---
@ -515,9 +525,11 @@ if __name__ == "__main__":
### 2.3 Code Quality
**Checklist:**
- [ ] Black formatting: `tox -e format`
- [ ] Ruff linting: `tox -e lint`
- [ ] Type checking: `tox -e type`
- [x] Black formatting: `tox -e format`
- [x] Ruff linting: `tox -e lint`
- [x] Type checking: `tox -e type` (with pragmatic type: ignore for Qt inheritance)
- [x] Coverage report: `pytest --cov=src/webdrop_bridge` (85% achieved)
- [ ] Security scan: `pip audit` (optional future)
- [ ] Coverage report: `pytest --cov=src/webdrop_bridge`
- [ ] Security scan: `pip audit`