Ahlyab / Ahlyab/slowpoke

Add basic tests for DNF flow

未关闭
#6 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
0
派生
0
PR 合并指标
30 天内没有已合并 PR

描述

## 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`

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。