← Back to issue list

tests: mock and test provider calls from lifecycle.py

View original Github issue

Metadata

Project
snapcraft
Number
#3928
Type
pull request
State
merged
Author
mr-cal
Labels
—
Created
Updated
Closed

Current evaluation

Merged #3928 in commit f0173bef1, adding mocked craft-providers lifecycle tests, aligning verbosity handling with Charmcraft and Rockcraft, and increasing coverage by 0.10%.

Resolution: closed resolved

Reason: PR #3928 was merged as commit f0173bef1. It added full mocked coverage of provider calls from lifecycle.py and achieved 100% diff coverage.

Evaluated by: mr-cal-bot

No scores available.

Issue body

- [X] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [X] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [X] Have you successfully run `make lint`? - [X] Have you successfully run `pytest tests/unit`? ----- ### Overview Mock and test calls made to `craft-providers` from `lifecycle.py`. This code was not being tested. I also simplified the `verbosity` call to match [charmcraft](https://github.com/canonical/charmcraft/blob/b22fcdba3b894004468abfbf45caa54d93fbf7d0/charmcraft/commands/build.py#L321) and [rockcraft](https://github.com/canonical/rockcraft/blob/5d7ed67646a10e5b35319c12d664df7b1e1a14b9/rockcraft/lifecycle.py#L197). ### Details 3 weeks ago, I [added some unit tests](https://github.com/snapcore/snapcraft/pull/3906) for `run_in_provider()`. Today, I am extending those tests further. The test fixtures are copies of the implementations in [charmcraft](https://github.com/canonical/charmcraft/blob/b22fcdba3b894004468abfbf45caa54d93fbf7d0/tests/conftest.py#L133) and [rockcraft](https://github.com/canonical/rockcraft/blob/5d7ed67646a10e5b35319c12d664df7b1e1a14b9/tests/unit/conftest.py#L28). I'll be using these tests next week when I pull code out of the providers directory.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged #3928 in commit f0173bef1, adding mocked craft-providers lifecycle tests, aligning verbosity handling with Charmcraft and Rockcraft, and increasing coverage by 0.10%.
stealth/space-bunny-alpha — closed resolved Merged PR #3928 as commit f0173bef1, adding provider-call tests for lifecycle.py and simplifying verbosity handling; diff coverage reached 100%.
stealth/space-bunny-alpha — closed resolved PR #3928 by mr-cal merged as commit f0173bef1: adds mocked unit tests for craft-providers calls in lifecycle.py and simplifies the verbosity call to match charmcraft/rockcraft. Raised coverage 0.10% with 100% diff coverage.
stealth/space-bunny-alpha — closed resolved PR #3928 merged as commit f0173bef1, adding mocked unit tests for craft-providers calls in lifecycle.py and simplifying verbosity handling to match charmcraft/rockcraft. Diff coverage 100%, project coverage +0.10%.
stealth/space-bunny-alpha — closed resolved Merged #3928 in commit f0173bef1, adding lifecycle.py provider-call tests and aligning verbosity handling with charmcraft and rockcraft. Coverage rose 0.10%, with 100% diff coverage.
qwen/qwen3.6-35b-a3b — — Merged unit tests mocking craft-providers calls in lifecycle.py. Simplified verbosity handling to align with charmcraft and rockcraft. Approved, passed CI, and increased overall test coverage by 0.10% with 100% diff coverage.
qwen3.6-35b-a3b-mtp-q6 — — Merged unit tests mocking craft-providers calls in lifecycle.py, alongside simplified verbosity handling. Achieved 100% diff coverage, increased overall coverage by 0.10%, and reduced code lines.

Update history

No update history recorded yet.

Related work

  • Related To: snapcore/snapcraft#3906 (confidence 98%)

    Earlier unit tests for run_in_provider() that PR #3928 extended.

Related issues

Issue Project State Summary Similarity
#83 tests: test lifecycle.py::_run_in_provider rockcraft merged Merged in commit 2f5b9c48, adding unit coverage for lifecycle.py::_run_in_provider() and raising lifecycle.py coverage from 16% to 36%.
72%