Skip to content

Test scripts/ and check every pull request - #26

Merged
patrickballard merged 3 commits into
wheelgap:mainfrom
sarankumar1325:tests-and-pr-check
Nov 11, 2026
Merged

patrickballard merged 3 commits into
wheelgap:mainfrom
sarankumar1325:tests-and-pr-check

Conversation

@sarankumar1325

Copy link
Copy Markdown
Contributor

Closes #16.

Tests (tests/test_scripts.py, unittest style like test_most_wanted.py, small JSON written to a temp dir, no network, never the real data/coverage.json):

  • update_history.update: a new day is appended, a missing history file starts one, the same day is replaced, entries stay sorted by date.
  • check_scan.problems: a good scan has no problems. Each of these is reported: too few packages, a missing summary label, no targets at all, a results list of the wrong length, a package missing fields, the wrong schema, too many lookup errors, and a >10% drop in wheels. A drop of exactly 10% passes, and ALLOW_DROP skips the drop check.
  • build_lookup.build: one file per package under its normalised name, with the fields the README's "API for scripts and agents" section lists (and no others), plus the packages.json index. Unsafe and duplicate names are skipped, and a wrong scan schema stops the build.

Check workflow (.github/workflows/check.yml): runs on pull_request and on push to main, with contents: read only and no stored credentials. Steps: uvx --python 3.13 pytest, then node --check site/app.js. The actions are pinned to the same commits as scan.yml.

pytest config: a pyproject.toml with only [tool.pytest.ini_options] (pythonpath = ["."], testpaths = ["tests"]), so a bare pytest/uvx pytest can import scripts, as suggested in the issue comment.

README: one line under Contributing on how to run the tests.

Checked locally: uvx pytest gives 25 passed (the new tests plus the existing CSV and most-wanted tests), and python -m unittest discover -s tests also passes. node --check site/app.js and ruff check tests are clean, and the workflow YAML and pyproject.toml parse.

I used an AI assistant for this change and reviewed the code and tests myself.

sarankumar1325 and others added 3 commits November 11, 2026 08:29
Add tests/test_scripts.py for update_history.update, check_scan.problems
and build_lookup.build (small JSON in a temp dir, no network), a pytest
config that puts the repo root on sys.path, and a Check workflow that runs
the tests and node --check site/app.js on pull requests and pushes to main.

Closes wheelgap#16

Signed-off-by: sarankumar1325 <[email protected]>
@patrickballard

Copy link
Copy Markdown
Contributor

Merged, thanks @sarankumar1325! The tracker now checks every pull request. The independent review compared each assertion with the scripts and found none wrong or tautological. The workflow can't hand secrets to fork PRs: it triggers on pull_request, has read-only permissions and keeps no stored credentials.

I pushed three small changes:

  • pytest pinned: [email protected], pinned like the actions, so a new pytest release can't change the check unannounced.
  • Python 3.14: the tests now run on 3.14, the same Python the nightly scan runs the scripts with.
  • One more test: check_scan's error limit now has a case using the lookup_errors count that real scans record, not just the fallback count.

The check passed on this PR: 26 tests on Python 3.14.4.

If you'd like another one, #27 (knowledge base v0: the notes/ format and its checker) is open. It's the start of Phase 2 of the roadmap, and the check you've just added is where its checker would run.

(Review assisted by Claude.)

@patrickballard
patrickballard merged commit e6d771e into wheelgap:main Nov 11, 2026
1 check 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.

Tests for scripts/ and a check that runs on every PR

2 participants