test: unit tests for lifecycle service
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
- [x] Have you followed the guidelines for contributing?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `make lint && make test`?
---
Addresses review feedback from #54 requesting unit test coverage for the `Lifecycle` service class.
### Changes
- Add `tests/unit/services/test_lifecycle.py` with tests covering:
- `_get_prime_dirs_from_project()` helper function (partition-to-package name mapping)
- `Lifecycle.get_prime_dir()` method (including error handling for non-existent packages)
- `Lifecycle.prime_dirs` property
### Test Coverage
```python
# Tests verify partition prefix stripping works correctly
project_info.prime_dirs = {
"package/my-package": Path("/work/partitions/package/my-package/prime"),
}
result = _get_prime_dirs_from_project(project_info)
# Returns: {None: default_prime, "my-package": package_prime}
```
Tests also verify:
- Non-package partitions are ignored
- Empty partition keys are handled
- `DebcraftError` is raised for non-existent package lookups
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for you](https://github.com/canonical/debcraft/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.
Evaluation history
No evaluation history available.