Skip to content

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

Closed

Description

@patrickballard

The tracker has no checks on pull requests: nothing runs until a PR is merged and the nightly scan or deploy uses it. The three scripts in scripts/ (check_scan.py, update_history.py, build_lookup.py) are small and pure, so they're easy to test, and a broken site/app.js should be caught before merge.

What to do

  • Add tests/test_scripts.py using pytest, with small JSON data written to tmp_path (no network, and don't use the real 2.2 MB data/coverage.json):
    • update_history.update: a new day is appended, the same day is replaced, and entries stay sorted by date;
    • check_scan.problems: a good scan has no problems; too few packages, a missing summary label, a results list of the wrong length and a large drop in wheels are each reported;
    • build_lookup.py: one small file per package, with the fields the README's "API for scripts and agents" section promises.
  • Add .github/workflows/check.yml, running on pull_request and on push to main:
    • pytest (install it with pip install pytest, or with uvx pytest);
    • node --check site/app.js, so a syntax error in the site is caught.
    • Pin actions by commit SHA, as scan.yml does.
  • A line in README.md on how to run the tests.

Changes under .github/ get a closer review, so expect a few comments.

Activity

  1. added
    enhancement
    good first issue
    on Nov 10, 2026
  2. patrickballard commented on Nov 11, 2026

    @patrickballard
    ContributorAuthor

    A head start for whoever takes this: #24 added the first test, tests/test_most_wanted.py (unittest style, which pytest collects as is). It imports from scripts import build_most_wanted, so the repo root has to be on sys.path. python -m pytest and python -m unittest discover -s tests do that, but a bare pytest doesn't. Add pythonpath = ["."] to the pytest config (or an empty conftest.py at the root) when you set up the check.

    (Reply assisted by Claude.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions