← Back to issue list

The `craft_parts.packages.deb` module is incorrectly tested

View original Github issue

Metadata

Project
craft-parts
Number
#368
Type
issue
State
closed
Author
facundobatista
Labels
—
Created
Updated
Closed

Current evaluation

Fixed by merged PR #563 (commit 18458997), replacing ineffective assert_has_calls checks in craft_parts.packages.deb tests with exact mock_calls assertions.

Resolution: closed resolved

Reason: PR #563 merged as commit 18458997 and rewrote the tests to compare fake_deb_run.mock_calls directly, exposing previously hidden failures and correcting the assertions.

Evaluated by: mr-cal-bot

No scores available.

Issue body

There are 10 calls to `assert_has_calls`, which is misused in the tests. E.g., the test `test_already_installed_no_specified_version` is currently doing... ``` fake_deb_run.assert_has_calls([]) ``` Attempting to validate that there are no calls to `apt` ("already installed!")... however, that line is a noop, as it does not verify any call in the mocker. Probably `assert_not_called` should have been used here (which would fail, as *there are* calls, because the test is buggy).

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #563 (commit 18458997), replacing ineffective assert_has_calls checks in craft_parts.packages.deb tests with exact mock_calls assertions.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #563 (commit 18458997), replacing ineffective assert_has_calls checks in packages.deb tests with mock_calls assertions.
qwen/qwen3.6-35b-a3b — — Closed after identifying that ten tests for craft_parts.packages.deb misuse assert_has_calls, masking failures. Tests require revision and rewriting to properly validate behavior. No fixes were merged.
qwen/qwen3.6-35b-a3b — — Closed without resolution. Misused assert_has_calls calls in craft_parts.packages.deb tests were identified. A reviewer confirmed the tests fail when properly validated and require revision, effectively abandoning the issue for future work.
qwen/qwen3.6-35b-a3b — — Closed. Misused assert_has_calls in craft_parts.packages.deb tests was identified. Direct mock checks reveal underlying bugs. Tests require revision and fixes.
qwen3.6-35b-a3b-mtp-q6 — — Tests for craft_parts.packages.deb misuse assert_has_calls, masking failures. The issue was closed without resolution, deferring test revision and rewriting to address the misused assertions.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/craft-parts#563 (confidence 100%)

    Merged fix replacing the misused call assertions in tests/unit/packages/test_deb.py.

Related issues

Issue Project State Summary Similarity
#563 fix(tests): replace ineffective call assertions craft-parts merged Merged PR #563 (commit 18458997) replaced ineffective assert_has_calls checks with mock_calls equality assertions in packages.deb tests, fixing #368.
74%
#1250 build(deps): bump craft-parts to 2.34.0 rockcraft closed PR #1250 was closed unmerged after four CI checks failed; later commit ab4f617f updated craft-parts to 2.35.0 instead.
70%