← Back to issue list

fix(tests): skip apt-backed lifecycle test when python3-apt is unavailable

View original Github issue

Metadata

Project
rockcraft
Number
#1347
Type
pull request
State
open
Author
lengau
Labels
Created
Updated
Closed

Current evaluation

Skips apt-backed lifecycle test when python3-apt bindings are unavailable, preventing spurious test failures in non-distro environments.

Suggested action: needs review

Reason: This is a small, well-scoped fix (+13/-0 lines, 1 file) that addresses a real test failure when python3-apt bindings are unavailable. The author (a maintainer) has validated it locally. However, it has had 0 reviewers and no activity in 11 days, so it needs maintainer review before merging.

Impact: 25 Quick Win: 21.25 Staleness: 35 Complexity: 15 Confidence: 75

Issue body

## Summary `test_lifecycle_package_repositories` fails spuriously in environments where the `python3-apt` bindings are not importable for the active interpreter (e.g. non-distro virtualenvs / sandboxed dev environments). In those cases craft-parts raises: ``` craft_application.errors.PartsLifecycleError: Package backend 'apt' is not supported on this environment. ``` (`craft_parts.packages.deb._APT_CACHE_AVAILABLE` is `False` because `from .apt_cache import AptCache` raises `ImportError`.) This PR detects that situation in the test module and skips the affected test with a clear reason instead of failing. Environments with working apt bindings (e.g. distro Python on CI runners) are unaffected and continue to exercise the test. ## Validation - Before: `1 failed, 17 passed` in a python3.13 venv without python3-apt. - After: `17 passed, 1 skipped` in the same environment; `ruff check` and pre-commit hooks pass. --- - [x] I've followed the [contribution guidelines](https://github.com/canonical/rockcraft/blob/main/CONTRIBUTING.md). - [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/). - [x] I've successfully run `make lint && make test` (targeted: the affected test module).

Evaluation history

Date Model Scores Action Summary
qwen3.6-35b-a3b-mtp-q6
Impact: 25
Quick Win: 21.25
Staleness: 35
Complexity: 15
Confidence: 75
needs review Skips apt-backed lifecycle test when python3-apt bindings are unavailable, preventing spurious test failures in non-distro environments.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 10
Confidence: 90
needs review Skips the test_lifecycle_package_repositories test when python3-apt bindings are unavailable, preventing spurious failures in sandboxed environments. Currently awaiting maintainer review with passing CI.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 5
Confidence: 90
needs review Skips the apt-backed lifecycle test when python3-apt bindings are unavailable, preventing spurious failures in sandboxed or non-distro environments. Currently awaiting maintainer review with no CI checks yet.

Update history

Date Change
updated
created

Related issues

No related issues found above the similarity threshold.