Skip to content

Conversation

@je-cook
Copy link
Collaborator

@je-cook je-cook commented Feb 6, 2026

Description

Closes #2901

tests seemingly were slow because there was loads of data in the unit test files. The tests now run locally in under 10s

I've also done some cleanup while I was there with json file formatting (adding biome for pre-commit) and added a plotting switch to the tests to disable showing of figures unless requested.

The fixtures around plotting mean that you can optionally mark test classes and the plots will be shown after all tests in that class have run

Checklist

I confirm that I have completed the following checks:

  • My changes follow the PROCESS style guide
  • I have justified any large differences in the regression tests caused by this pull request in the comments.
  • I have added new tests where appropriate for the changes I have made.
  • If I have had to change any existing unit or integration tests, I have justified this change in the pull request comments.
  • If I have made documentation changes, I have checked they render correctly.
  • I have added documentation for my change, if appropriate.

@je-cook je-cook requested a review from a team as a code owner February 6, 2026 12:10
@je-cook je-cook added the Testing label Feb 6, 2026
@je-cook je-cook force-pushed the tests_speedup branch 2 times, most recently from ea4a7bd to f0fb111 Compare February 6, 2026 12:19
@codecov-commenter
Copy link

codecov-commenter commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.47%. Comparing base (ca03a41) to head (1f8336c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4084   +/-   ##
=======================================
  Coverage   46.47%   46.47%           
=======================================
  Files         123      123           
  Lines       28902    28902           
=======================================
  Hits        13432    13432           
  Misses      15470    15470           

☔ View full report in Codecov by Sentry.
📢 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.

@timothy-nunn
Copy link
Collaborator

I will perform a full review later, but I have one comment about the scope of #2901. Are we only considering unit tests to be within the scope of the issue? Our integration tests are also very useful to run locally when making changes outside of unit tested models, however they are pretty slow. Is there a separate issue for the integration tests>

@je-cook
Copy link
Collaborator Author

je-cook commented Feb 6, 2026

I can have a look at the integration tests too. On the CI at least its the fastest (Obviously the unit tests are run for each python version)
image

@je-cook
Copy link
Collaborator Author

je-cook commented Feb 6, 2026

Heres the tests slower than 1s on my laptop split into the three categories that hit that barrier. To me only the examples and the first regression could be considered a long time for the type of 'tests' they are (possibly the plot_proc test in integration). Integrations locally take 1m8s which i dont think is that long personally for integration style testing.

Examples:

122.62s call     tests/examples/test_examples.py::test_scan
84.71s call     tests/examples/test_examples.py::test_varyrun_example
79.35s call     tests/examples/test_examples.py::test_examples
11.55s call     tests/examples/test_examples.py::test_plot_solutions
4.94s call     tests/examples/test_examples.py::test_single_model_evaluation

Integration

49.16s call     tests/integration/test_main_int.py::test_plot_proc
29.54s call     tests/integration/test_plot_proc.py::test_input_file
29.05s call     tests/integration/test_plot_proc.py::test_input_file_cwd
21.46s call     tests/integration/test_main_int.py::test_vary_run
21.02s call     tests/integration/test_main_int.py::test_single_run_cwd
20.10s call     tests/integration/test_main_int.py::test_vary_run_cwd
20.10s call     tests/integration/test_main_int.py::test_single_run
1.97s call     tests/integration/test_plot_scans.py::test_plot_scans_stack
1.66s call     tests/integration/test_main_int.py::test_single_run_with_mfilejson

Regression

118.07s call     tests/regression/test_process_input_files.py::test_input_file[low_aspect_ratio_DEMO]
25.46s call     tests/regression/test_process_input_files.py::test_input_file[st_regression]
20.32s call     tests/regression/test_process_input_files.py::test_input_file[large_tokamak_nof]
3.02s call     tests/regression/test_process_input_files.py::test_input_file[helias_5b]
2.69s call     tests/regression/test_process_input_files.py::test_input_file[large_tokamak_eval]
1.85s call     tests/regression/test_process_input_files.py::test_input_file[stellarator_helias_eval]
1.55s call     tests/regression/test_process_input_files.py::test_input_file[spherical_tokamak_eval]
1.09s setup    tests/regression/test_process_input_files.py::test_input_file[IFE]

@timothy-nunn
Copy link
Collaborator

Thanks for checking, I had in my head that the integration tests were much slower but I guess splitting the examples tests out solved that.

@timothy-nunn timothy-nunn merged commit 6ba13ca into ukaea:main Feb 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create subset of tests for fast local running

3 participants