Skip to content

test(updater): exercise real MSIX detection in short-circuit test#129

Merged
nelsonduarte merged 1 commit into
mainfrom
chore/test-and-ignore-cleanup
Jul 18, 2026
Merged

test(updater): exercise real MSIX detection in short-circuit test#129
nelsonduarte merged 1 commit into
mainfrom
chore/test-and-ignore-cleanup

Conversation

@nelsonduarte

Copy link
Copy Markdown
Owner

Summary

Two small cleanups flagged in review.

1. Tautological test in tests/test_updater_msix.py

test_check_for_update_returns_none_on_msix mocked is_system_install — the exact function under test — so it asserted nothing beyond "a mock returns what I told it to". It survived mutation of the code it was supposed to guard.

The test now patches only the environment the detection reads (sys.platform, PACKAGE_FULL_NAME, sys.executable) plus the urlopen network boundary, so the real chain check_for_update -> is_system_install -> is_msix_install executes. It asserts both that None is returned and that no HTTP request was attempted.

A second case, test_check_for_update_returns_none_on_msix_via_windowsapps_path, clears the env var so the load-bearing \WindowsApps\ path branch is the only thing that can short-circuit.

Mutation testing (proof it is now discriminative) — temporarily replaced the win32 branch of is_system_install() with return False:

test vs. mutant
old test_check_for_update_returns_none_on_msix PASSED (survived — tautology confirmed)
new test_check_for_update_returns_none_on_msix FAILED (mutant killed)
new ..._via_windowsapps_path FAILED (mutant killed)

app/updater.py was restored byte-identical afterwards; it carries no change in this PR (git diff clean).

2. .gitignore

artifacts-*/ (with an "i") did not cover the artefacts-*/ spelling, leaving local release artifacts showing as untracked. Added the missing pattern alongside the existing one.

Validation

  • pytest -q -> 442 passed, 2 skipped, 0 failed (441 baseline + 1 new test)
  • ruff check tests/test_updater_msix.py -> All checks passed
  • git check-ignore -v artefacts-1.14.0/ -> .gitignore:23:artefacts-*/

No production code changed; test-only plus one ignore pattern.

🤖 Generated with Claude Code

test_check_for_update_returns_none_on_msix mocked is_system_install --
the very function whose behaviour it claims to verify -- so it passed
regardless of what the detection chain did. Reverting the win32 branch
of is_system_install() to `return False` left the test green: false
coverage on a load-bearing safety check.

Patch only the environment the detection reads (sys.platform, the
PACKAGE_FULL_NAME env var, sys.executable) plus the urlopen network
boundary, so the genuine composition
check_for_update -> is_system_install -> is_msix_install runs. Assert
both that None is returned and that no HTTP request was attempted. A
second case covers the load-bearing \WindowsApps\ path branch with the
env var cleared. Both now fail against that mutant.

Also add the artefacts-*/ spelling next to artifacts-*/ in .gitignore;
the "e" variant was not covered and left local release artifacts
showing up as untracked.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying pdfapps with  Cloudflare Pages  Cloudflare Pages

Latest commit: b15510e
Status: ✅  Deploy successful!
Preview URL: https://b2c38d1f.pdfapps.pages.dev
Branch Preview URL: https://chore-test-and-ignore-cleanu.pdfapps.pages.dev

View logs

@nelsonduarte
nelsonduarte merged commit 3a62598 into main Jul 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant