Ahlyab / Ahlyab/slowpoke

Add basic tests for DNF flow

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Summary

Extend automated coverage for the **DNF** path: mocked subprocess calls and assertions on the **plan users see in the dry-run** (command steps, normalization), building on existing tests.

## Current state

- **`tests/test_dnf_manager.py`** — covers `DnfManager.search()` with mocked `run_capture` (parsing, fallbacks, empty results). It does **not** cover `DnfManager.build_install_plan()`.
- **`tests/test_orchestrator.py`** — heavy coverage for `build_docs_install_plan`, DNF normalization, and `detect_dnf_variant()`; it does **not** exercise `build_install_plan()` from `src/slowpoke/core/orchestrator.py` (the flow that combines local search + LLM resolution + optional DNF step normalization).

## Goals

1. **Mock command execution** — Continue using `monkeypatch` on `run_capture` (or targeted mocks) so tests stay hermetic and fast; no real `dnf` on CI required.
2. **Validate dry-run behavior** — Assert the resulting `CommandPlan`: expected `executable`, `args`, `needs_sudo`, and after DNF-specific handling where applicable (e.g. `_normalize_dnf_step` / variant detection mocked as in existing orchestrator tests).

## Suggested scope (pick one or combine in small PRs)

- Add unit test(s) for `DnfManager.build_install_plan()` (install step shape, e.g. `dnf install -y …`).
- Add focused test(s) for `build_install_plan()` with a **fake `PackageManager`** + **fake `LLMClient`** so the “candidates found → resolve name → plan” path is covered for `package_manager.name == "dnf"` (including normalization branch if you mock `detect_dnf_variant`).

## Acceptance criteria

- [ ] New tests fail if install-step structure or DNF normalization for the happy path regresses.
- [ ] No network calls; no reliance on Fedora in CI.
- [ ] Follow patterns in `tests/test_dnf_manager.py` and `tests/test_orchestrator.py`.

## References

- `src/slowpoke/core/orchestrator.py` — `build_install_plan()`
- `src/slowpoke/system/package_managers/dnf.py` — `DnfManager`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.