Skip to content

Faster tests: parallel by default locally, balanced CI jobs, slowest tests trimmed #356

Done

Description

@lanyue-llk

Part of #336. Size: S–M.

Problem

Measured on main (24k tests):

Where How Wall time
Local, make test-python serial about 25 min
Local, -n 8 --dist worksteal (10-core Mac) parallel 4 min 47 s
CI primary job shard 1/2, -n 4, plus lint, naming, shell, fixture smoke, UI and extraction SDK tests 9 min 10 s
CI secondary job shard 2/2, -n 4 5 min 52 s (pytest 4 min 56 s)
  • make test-python does not parallelise locally, although pytest-xdist is a test dependency and CI already uses it.
  • The primary CI job also runs every static check and the Node/SDK suites, so it finishes about 3 minutes after the secondary job and sets the wall time.
  • A few tests dominate a worker: tests/web_search/test_native_revisions.py::test_locked_reference_extensions_rescore_all_methods_without_replacing_original_gold takes 174 s; six tests/benchmarks/webfetch/test_release_versions.py cases and test_benchmark.py::PublicDefinitions::test_all_shipped_suites_are_consistent take 32–36 s each, mostly re-validating the full shipped catalog; test_explicit_utf8_io.py::test_report_builds_are_byte_identical_under_an_ascii_locale takes 34 s.
  • Shards are assigned by hashing test ids, not by duration.

Direction

  1. make test-python runs with -n auto --dist worksteal by default (overridable), and CONTRIBUTING.md says so.
  2. Move lint, naming, shell, fixture smoke, UI and extraction SDK checks into their own CI job so both pytest shards carry only pytest.
  3. Cut the slowest tests without losing coverage: validate the shipped catalog once per session and share it (fixture), and reduce the 174 s revision test to the smallest population that exercises the same rules.
  4. Optionally shard by recorded durations if the shards stay unbalanced after 2 and 3.

Done when

Activity

  1. added
    refactor
    on Nov 24, 2026
  2. lanyue-llk commented on Nov 24, 2026

    @lanyue-llk
    ContributorAuthor

    Done: local tests run in parallel by default and CI runs pytest apart from static checks (#358); every test file was reviewed once for necessity and cost (#361–#365). CI wall time went from 9 min 10 s to about 4 min 25 s. Per the revised criteria there is no fixed time target; further cheap cuts can be taken as they come up.

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

    refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions