utils: fix snap environment detection and add tests (CRAFT-376)
Metadata
Current evaluation
Merged #97 via a4e14f1c, fixing false-positive Snap detection and adding tests for is_snap() and is_inside_container(). The earlier proposed redirect to #99 did not prevent the merge.
Resolution: closed resolved
Reason: PR #97 was approved and merged as a4e14f1c, with follow-up commit 7c398131 using the application name for Snap detection. Although an initial comment favored #99, #97 ultimately merged while #99 closed unmerged.
Evaluated by: mr-cal-bot
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 |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged #97 via a4e14f1c, fixing false-positive Snap detection and adding tests for is_snap() and is_inside_container(). The earlier proposed redirect to #99 did not prevent the merge. | |
| stealth/space-bunny-alpha | — | closed resolved | canonical/craft-parts#97 merged via a4e14f1c, fixing snap detection and adding is_snap() and is_inside_container() tests. The comment favoring #99 did not prevent the merge. | |
| 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 work
-
Related To:
canonical/craft-parts#99
(confidence 98%)
Initially proposed as the replacement for #97, but it closed unmerged.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1849 tests: add snap not found tests | snapcraft | merged | Merged missing-snap test coverage; snapcraft PR #1849 landed as commit 54cf2bd9e. | |
| #4755 tests: fix devel base snap test | snapcraft | merged | Merged #4755, fixing the devel-base integration test to verify Snapcraft can create the base snap and that the resulting devel base is usable. | |
| #1625 tests: use the snapcraft snap for integration tests | snapcraft | merged | Merged PR #1625 updated integration tests to run the installed Snapcraft snap, better matching the user environment. Resolution: commit eebb070e6. | |
| #2295 tests: use SNAPCRAFT_PACKAGE_TYPE everywhere | snapcraft | merged | PR #2295 merged as commit ffbad69ea: unit tests now use SNAPCRAFT_PACKAGE_TYPE instead of legacy SNAPCRAFT_FROM_* env vars, and unused container tests were removed to ease migration to spread. (LP: #1794379) |