Skip to content

Split test_healthsystem.py into two files to enable parallel running and so speed up testing.#1807

Merged
tamuri merged 4 commits intomasterfrom
hallett/proposal-for-healthsystem-test-split
Feb 26, 2026
Merged

Split test_healthsystem.py into two files to enable parallel running and so speed up testing.#1807
tamuri merged 4 commits intomasterfrom
hallett/proposal-for-healthsystem-test-split

Conversation

@tbhallett
Copy link
Copy Markdown
Collaborator

Here I propose a split of the test_healthsystem.py into:

  1. test_healthsystem_general_and_mode1.py: This test file is focussed on the overall function of the module and its behaviour in Mode 1.
  2. test_healthsystem_mode2.py: This test file is focussed on behaviour in Mode 2 (including rescaling and clinics).

This feels like a logical way to split the tests. However, the first of these still contains more tests, so may still take much longer. If necessary, a further cut could be made!

@tamuri
Copy link
Copy Markdown
Collaborator

tamuri commented Feb 6, 2026

Looks like mode2 test took only 4 mins!


================================ resource usage ================================
tests/test_healthsystem_mode2.py::test_run_in_mode_2_with_capacity[83563095832589325021] (call) running time: 0:01:02
tests/test_healthsystem_mode2.py::test_run_in_mode_2_with_no_capacity[83563095832589325021] (call) running time: 37.705 seconds
tests/test_healthsystem_mode2.py::test_mode_appt_constraints2_on_healthsystem[83563095832589325021] (call) running time: 3.262 seconds
tests/test_healthsystem_mode2.py::test_run_in_mode_2_with_capacity_with_health_seeking_behaviour[83563095832589325021] (call) running time: 0:01:14
tests/test_healthsystem_mode2.py::test_mode_2_clinics[83563095832589325021] (call) running time: 0:01:23
================= 5 passed, 299 warnings in 265.76s (0:04:25) ==================

@tbhallett
Copy link
Copy Markdown
Collaborator Author

Ok, will try something else!

@tamuri
Copy link
Copy Markdown
Collaborator

tamuri commented Feb 6, 2026

The big ones are these three:

test_policy_has_no_effect_on_mode1 running time: 0:30:09
test_which_hsi_can_run running time: 0:17:54
test_scaling_up_HRH_using_yearly_scaling_and_scaling_by_level_together running time: 0:13:04

@tbhallett tbhallett changed the title Split test_healthsystem.py into two files to enable parallel running and so speed us testing. Split test_healthsystem.py into two files to enable parallel running and so speed up testing. Feb 6, 2026
@tbhallett
Copy link
Copy Markdown
Collaborator Author

Now completing in
test_healthsystem_general: 51 minutes
test_healthsystem_hrh: 38 minutes

So, could split test_healthsystem_general into two....

Copy link
Copy Markdown
Collaborator

@tamuri tamuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Tim. This cuts the current test runtime in about half - merging!

@tamuri tamuri merged commit a925329 into master Feb 26, 2026
70 checks passed
@tamuri tamuri deleted the hallett/proposal-for-healthsystem-test-split branch February 26, 2026 21:34
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.

2 participants