utils: fix snap environment detection and add tests (CRAFT-376)
Metadata
Current evaluation
Merged. Fixed snap environment detection and added tests for is_snap() and is_inside_container(). Updated is_snap() to require an application name, refactored package manager
Suggested action: —
No scores available.
Issue body
Snap environment detection returned false positives and was not being
properly tested. Fix snap environment detection and add tests for
`is_snap()` and `is_inside_container()`.
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Fixed snap environment detection and added tests for is_snap() and is_inside_container(). Updated is_snap() to require an application name, refactored package manager | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Fixed snap environment detection false positives and added tests for is_snap() and is_inside_container(). Updated is_snap() to require an application name, modified package manager config execution, and added an optional application_package_name parameter. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #4 snap: introduce initial snap packaging (CRAFT-578) | rockcraft | merged | Merged initial snap packaging implementation (CRAFT-578). Approved by one reviewer, passed CI checks, and added 86 lines across three files. | |
| #46 tests: add fake snapd fixture | craft-parts | merged | Merged after two approvals and passing CI. Introduces a fake snapd fixture to test snap package handling in craft-parts.packages. Adds 212 lines across two files. Windows compatibility limitations were noted for separate follow-up. | |
| #2295 tests: use SNAPCRAFT_PACKAGE_TYPE everywhere | snapcraft | merged | Merged PR #2295 to replace SNAPCRAFT_FROM_ environment variables with SNAPCRAFT_PACKAGE_TYPE across all tests, removing unused container tests and streamlining the spread testing transition. Approved with no coverage impact. | |
| #4755 tests: fix devel base snap test | snapcraft | merged | Merged a fix for the devel base snap test. The update ensures snapcraft correctly creates and utilizes the devel base. Approved by two reviewers, passed CI checks, and applied with a minimal one-file change. | |
| #49 packages: add snap package support | craft-parts | merged | Merged after implementing snap download and installation for stage and build snaps. Approved by two reviewers, passed CI, and added 1,072 lines across five files. Follows snapcraft conventions with future refactoring planned. | |
| #4596 fix(package): use correct target-arch on snap | snapcraft | merged | Merged following approval. Fixes incorrect target-arch in the Package service, aligns tests with craft-application updates, and updates spread tests. 14 files changed, +61/-50 lines. |