Skip to content

Add GitHub Actions CI + test-settings shim + split tests into a package #1279

@jonfroehlich

Description

@jonfroehlich

First PR off the testing roadmap (#1278). Bundles three changes that depend on each other.

Scope (roadmap items 1 + 2 + 3)

2. Test-settings shim (do first — CI depends on it)

  • Add makeabilitylab/settings_test.py that imports * from settings and sets MIGRATION_MODULES = {'website': None}.
  • Tests run with manage.py test website --settings=makeabilitylab.settings_test; the runner derives schema directly from current models (--run-syncdb behavior), bypassing the gitignored, per-environment migration history.
  • Durable fix for the column "..." already exists test-DB failures noted in Need much better testing infracture on local host #1267 and CLAUDE.md — and required for CI, since a clean runner has no migrations on disk.

3. Split website/tests.py into a website/tests/ package

  • tests/__init__.py, tests/base.py (the DatabaseTestCase base, fixture helpers, GIF/PDF byte constants).
  • Group existing classes into test_bio_utils.py, test_publication.py, test_serve_pdf.py, test_artifact.py, test_data_health.py, test_views.py, test_models.py, etc.
  • Pure move — Django auto-discovers tests/test_*.py. No behavior change; assert identical test count before/after.

1. GitHub Actions CI

  • .github/workflows/test.yml: trigger on pull_request and push to master.
  • Postgres 16 service container; Python 3.13; pip install -r requirements.txt; run the suite with the test settings shim.
  • Mirror the local env (the [Postgres]-absent → HOST=db default; CI overrides DB host/creds via env to point at the service container).

Acceptance criteria

  • manage.py test website --settings=makeabilitylab.settings_test passes locally from a clean test DB with no manual drop step.
  • Test count after the package split == count before (no tests lost).
  • A pushed PR shows a green check; an intentionally-broken test shows a red ✗ + email.
  • No branch protection enabled yet — CI reports only (can tighten later).

Out of scope (later PRs)

Coverage (#1278 item 4), test backfill (item 5), Pa11y-in-CI (item 6).

Part of #1278.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions