8000 test: split the slow test modules so that each runs in about two minutes or less by rafatahmed · Pull Request #407 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

test: split the slow test modules so that each runs in about two minutes or less - #407

Merged
rafatahmed merged 1 commit into
mainfrom
refactor/split-slow-test-modules
Nov 30, 2026
Merged

rafatahmed merged 1 commit into
mainfrom
refactor/split-slow-test-modules

Conversation

@rafatahmed
@rafatahmed rafatahmed commented Nov 30, 2026 •
Copy link
Copy Markdown
Owner

NOT READY until CI is green.

Closes #406

Splits the test modules that took more than about two minutes alone, so that each runs well inside the five-minute limit even at twice the load. Test bodies are moved unchanged; helpers go to support modules (*_support.py).

Module Alone before Alone after
test_ratio_allocation_reliability 579 s 6 modules: 104, 108, 110, 104, 104 and 1 s
test_ratio_solver_stress 535 s 6 modules: 126, 125, 124, 135, 68 and 46 s (27 generated cases in chunks of 6)
packaged catalogue journey (even and odd) 173 to 327 s 4 parts: 99, 64, 88 and 89 s
test_mix_cli 267 to 461 s 4 modules: 177 (one test), 112, 103 and 56 s
test_status_matrix_wiring 275 s 3 modules: 99, 99 and 86 s
test_ph_inputs 198 s 3 modules: 77, 77 and 2 s
test_grower_outputs 157 s 2 modules: 82 and 112 s
test_precipitation_report about 155 s 2 modules: 35 and 118 s (one test)
test_ratio_search_constraints 157 s 3 modules: 69, 64 and 15 s
test_independent_reagent_capacity 122 to 282 s 2 modules: 94 and 60 s

Times are one sequential run of each module alone on one machine; the same tests took up to twice as long under load, which is why the line is about two minutes.

Proof that nothing was lost: the whole suite was collected on main and on this branch. All 2,282 test methods on main exist on the branch, and the only additions are two guard tests (2,284 in total, all ids unique). Each split also compared the test names of the module before and after (identical).

Also changed:

  • Two guard tests: the heavy allocation cases must still exist, and the stress cases must not outgrow their five chunks, so a new case cannot silently land in a module that is already full.
  • tools/ci_test_weights.json follows the moved tests. Where the file had only a class weight, it is shared by the number of tests in each part, so the new weights are approximate; they only balance CI shards.
  • tests/test_ci_parallel.py and the docs command in docs/steiner-allocation-validation.md follow the new modules; twelve test modules import from the new support modules instead of the old test modules.

Left whole on purpose (alone, one run): test_default_range_and_temperature 108 s, test_acceptable_incidental 115 s, test_grower_journey_reports 80 to 145 s, test_grower_journey_reagents 83 s. A single test cannot be split by module: test_second_field_session_by_name_and_readable_grams takes about 177 s and the brushite report test about 118 s; shrinking them would change the tests and is separate work.

Verified on this branch:

  • Every new or changed module was run alone, one at a time, in batches; all pass.
  • Lint passes; the only formatting difference is one line in test_ci_parallel.py that main already has.

Not yet verified: the CI coverage and Python 3.11 gates.

…tes or less

Ten modules took between 2.5 and 10 minutes alone. Each is now split into modules of at most about two minutes: the allocation reliability matrix (6 modules), the solver stress cases (6), the packaged catalogue journey (4), mix_cli (4), status matrix wiring (3), grower outputs (2), pH inputs (3), precipitation report (2), ratio search constraints (3) and independent reagent capacity (2). Helpers move to support modules; no test is changed. Two guard tests keep the generated cases from outgrowing their modules.
@rafatahmed rafatahmed added the enhancement New feature or request label Nov 30, 2026
@rafatahmed rafatahmed self-assigned this Nov 30, 2026
@codecov
codecov Bot commented Nov 30, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (fd722c9) to head (c8c8bff).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #407   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          152       152           
  Lines        18112     18112           
  Branches      3657      3657           
=========================================
  Hits         18112     18112           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

2 similar comments
@codecov
codecov Bot commented Nov 30, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (fd722c9) to head (c8c8bff).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #407   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          152       152           
  Lines        18112     18112           
  Branches      3657      3657           
=========================================
  Hits         18112     18112           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codecov
codecov Bot commented Nov 30, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (fd722c9) to head (c8c8bff).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #407   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          152       152           
  Lines        18112     18112           
  Branches      3657      3657           
=========================================
  Hits         18112     18112           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rafatahmed
rafatahmed marked this pull request as ready for review November 30, 2026 19:56
@codecov
codecov Bot commented Nov 30, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (fd722c9) to head (c8c8bff).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #407   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          152       152           
  Lines        18112     18112           
  Branches      3657      3657           
=========================================
  Hits         18112     18112           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rafatahmed
rafatahmed merged commit bc50134 into main Nov 30, 2026
29 checks passed
@rafatahmed
rafatahmed deleted the refactor/split-slow-test-modules branch November 30, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split the slow test modules so that each runs in about two minutes or less

1 participant

0