Some UI layer tests take longer than expected to run

Open
#593 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
python

Research direction

Start by running pytest --durations=0 tests/test_ui_layer.py and inspect the five slowest cases in tests/test_ui_layer.py, especially the pipeline-building tests. Trace what makes those cases slower than the others and verify that the full test file still passes with reduced durations and unchanged behavior.

Written by the indexing model from the issue text.

Description

testing

The top 5 stick out, in comparison to the rest of tests which take 0.01s or less:

(base) root@57b6bd69e7ba:/httomo# pytest --durations=0 tests/test_ui_layer.py
========================================== test session starts ===========================================
platform linux -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0 -- /opt/conda/bin/python3.12
cachedir: .pytest_cache
rootdir: /httomo
configfile: pyproject.toml
plugins: xdist-3.6.1, mpi-0.6, mock-3.14.0, cov-6.0.0
collected 20 items

tests/test_ui_layer.py::test_can_read_cpu_pipeline PASSED                                          [  5%]
tests/test_ui_layer.py::test_can_read_gpu_pipeline PASSED                                          [ 10%]
tests/test_ui_layer.py::test_uilayer_fails_with_nonexistant_file[does_not_exist.yaml] PASSED       [ 15%]
tests/test_ui_layer.py::test_pipeline_build_no_loader PASSED                                       [ 20%]
tests/test_ui_layer.py::test_pipeline_build_duplicate_id PASSED                                    [ 25%]
tests/test_ui_layer.py::test_pipeline_build_cpu_pipeline PASSED                                    [ 30%]
tests/test_ui_layer.py::test_build_pipeline_from_json PASSED                                       [ 35%]
tests/test_ui_layer.py::test_build_pipeline_with_param_sweeps[manual] PASSED                       [ 40%]
tests/test_ui_layer.py::test_build_pipeline_with_param_sweeps[range] PASSED                        [ 45%]
tests/test_ui_layer.py::test_raise_error_if_pipeline_is_yaml_string PASSED                         [ 50%]
tests/test_ui_layer.py::test_raise_error_if_pipeline_is_json_file PASSED                           [ 55%]
tests/test_ui_layer.py::test_update_side_output_references_invalid[no_ref] PASSED                  [ 60%]
tests/test_ui_layer.py::test_update_side_output_references_invalid[as ${{mixed_with_other}}] PASSED [ 65%]
tests/test_ui_layer.py::test_update_side_output_references_invalid[${{mixed_with_other}} asd] PASSED [ 70%]
tests/test_ui_layer.py::test_update_side_output_references_invalid[${{}}] PASSED                   [ 75%]
tests/test_ui_layer.py::test_update_side_output_references_invalid[${{with spaces}}] PASSED        [ 80%]
tests/test_ui_layer.py::test_update_side_output_references_invalid[${{inV-1%^&valid_chars}}] PASSED [ 85%]
tests/test_ui_layer.py::test_update_side_output_references_normal PASSED                           [ 90%]
tests/test_ui_layer.py::test_update_side_output_references_nosidestr PASSED                        [ 95%]
tests/test_ui_layer.py::test_update_side_output_references_notfound PASSED                         [100%]

=========================================== slowest durations ============================================
1.02s call     tests/test_ui_layer.py::test_pipeline_build_cpu_pipeline
0.79s call     tests/test_ui_layer.py::test_pipeline_build_duplicate_id
0.36s call     tests/test_ui_layer.py::test_build_pipeline_with_param_sweeps[range]
0.32s call     tests/test_ui_layer.py::test_build_pipeline_with_param_sweeps[manual]
0.23s call     tests/test_ui_layer.py::test_build_pipeline_from_json
0.02s call     tests/test_ui_layer.py::test_can_read_cpu_pipeline
0.01s setup    tests/test_ui_layer.py::test_raise_error_if_pipeline_is_json_file
0.01s call     tests/test_ui_layer.py::test_pipeline_build_no_loader
0.01s call     tests/test_ui_layer.py::test_can_read_gpu_pipeline
0.01s call     tests/test_ui_layer.py::test_update_side_output_references_notfound
0.01s call     tests/test_ui_layer.py::test_update_side_output_references_normal

(49 durations < 0.005s hidden.  Use -vv to show these durations.)
=========================================== 20 passed in 2.91s ===========================================
Dominant language
Python
Stars
10
Forks
5
Avg merge
5d 17h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DiamondLightSource/httomo

All issues in DiamondLightSource/httomo

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.