🐛 | Fix tests
All checks were successful
SonarQube Code Quality Scan / SonarQube Scan (push) Successful in 1m44s
All checks were successful
SonarQube Code Quality Scan / SonarQube Scan (push) Successful in 1m44s
This commit is contained in:
26
README.md
26
README.md
@@ -110,9 +110,31 @@ Tunetti stores its settings in `~/.config/tunetti/config.json`. Here's what you
|
||||
| [PySide6](https://pypi.org/project/PySide6/) | The graphical interface (Qt6) |
|
||||
| [pypresence](https://github.com/qwertyquerty/pypresence) | Discord Rich Presence |
|
||||
|
||||
## 🧪 Quality checks
|
||||
## 🧪 Testing
|
||||
|
||||
Code quality is analyzed automatically by SonarQube whenever changes are pushed.
|
||||
Tests use **pytest** with **coverage** and are designed to run both locally and in CI (SonarQube picks up the coverage report automatically).
|
||||
|
||||
```bash
|
||||
# Install test dependencies
|
||||
pip install -r requirements-dev.txt
|
||||
|
||||
# Run all tests
|
||||
.venv/bin/python -m pytest tests/ -v
|
||||
|
||||
# Run with coverage (generates coverage.xml for SonarQube)
|
||||
.venv/bin/coverage run -m pytest tests/
|
||||
.venv/bin/coverage xml
|
||||
```
|
||||
|
||||
| Module | Coverage | What's covered |
|
||||
|---|---|---|
|
||||
| `music_db.py` | 100% | All DB operations: record, favourites, history, stats, edge cases |
|
||||
| `config.py` | 87% | Load, save, migrate, volume clamping, get/set settings |
|
||||
| `discord_rpc.py` | 84% | `_safe_artists` edge cases, DiscordRPC lifecycle, mocked pypresence |
|
||||
| `player.py` | 32% | Helpers: `_best_thumbnail`, `_build_song_dict`, `_generate_test_wav`, `_stale_files`, `_build_resolved_dict` |
|
||||
| `gui.py` | 12% | Helpers: `_fmt_ms`, `_artists_str`, `_norm_artists`, `_artists_from_json` |
|
||||
|
||||
> The Qt GUI/player classes require a display server and PulseAudio — they can't run in headless CI. Guarded imports (in `player.py` and `gui.py`) ensure pure helper functions are still testable anywhere.
|
||||
|
||||
## 📄 License
|
||||
|
||||
|
||||
Reference in New Issue
Block a user