Skip to content

Speed up the test suite - #286

Merged
brianglass merged 1 commit into
mainfrom
test-speedup-main
Nov 7, 2026
Merged

brianglass merged 1 commit into
mainfrom
test-speedup-main

Conversation

@brianglass

Copy link
Copy Markdown
Owner

#285 merged into feasts-speedup after #284 had already been merged into main, so its changes never reached main. This is the same squashed commit, cherry-picked onto main. It applies cleanly and all 309 tests pass.

See #285 for the details: the test runner starts from the Docker image's database, fixtures load once per run, scriptures load with expat and bulk_create, and the unused ingest_usfx command is removed.

🤖 Generated with Claude Code

* Load the test data once per run, and shorten the API sweep

Thirty-eight test classes each reloaded both fixtures (0.8s apiece), and
the saint search tests backfilled slugs and rebuilt the search index
before every test. A test runner now does all of that once, after the
test database is created, as the Dockerfile does for production. The
day API sweep in test_errors covers one year instead of seven; the
fasting snapshot already covers ten years of Day.

The tests now take 13s instead of 87-102s. Building the test database,
which loads the scriptures, still takes about 38s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Start the tests from the database the Docker image built

The image's db.sqlite3 already has the migrations applied, including the
scripture loads that took about 38s of every run, and the fixtures,
slugs and search index loaded. The test runner now copies it into place
as the test database and keeps it, so a Docker test run takes 14s
instead of 57s. Without a current db.sqlite3 it builds from scratch and
loads the data once, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Load the scriptures with expat and bulk_create

parse_usfx went through pulldom, which builds a DOM node and attribute
objects for every element and text run, and the migrations inserted the
171,116 verses one row at a time. The same parsing logic now runs from
expat callbacks, and the verses go in with bulk_create. Loading the
scriptures takes 6.4s instead of 31.2s, which every image build and
every fresh test database pays; the verse table comes out byte for byte
the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Remove the unused ingest_usfx command

It passed parse_usfx a language argument it never accepted, so it failed
as soon as it ran. The scripture migrations load the Bibles instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@brianglass
brianglass merged commit 3813303 into main Nov 7, 2026
4 checks passed
@brianglass
brianglass deleted the test-speedup-main branch November 7, 2026 14:52
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