Improve python test process
By adding --durations=20
argument to the pytest
command you can list the slowest tests
python -m pytest --durations=20 --cov=nomad --cov-report term --cov-report xml:coverage.xml --cov-config=.coveragerc -sv tests
Results of a 36 mins test runtime:
========================== slowest 20 test durations ===========================
400.97s call tests/normalizing/test_workflow.py::test_radius_of_gyration
34.37s call tests/normalizing/test_workflow.py::test_rdf_and_msd
25.33s setup tests/normalizing/test_system.py::test_normalizer[parsers/dl-poly-tests/data/parsers/dl-poly/OUTPUT]
19.51s call tests/parsing/test_parsing.py::test_parser[parsers/dl-poly-tests/data/parsers/dl-poly/OUTPUT]
19.04s setup tests/normalizing/test_band_structure.py::test_paths
14.80s call tests/app/test_resources.py::test_cached_get_resources
12.64s call tests/app/test_resources.py::test_cache_invalidation_get_resources
10.57s setup tests/normalizing/test_system.py::test_normalizer[parsers/cp2k-tests/data/parsers/cp2k/si_bulk8.out]
9.62s setup tests/test_client.py::test_async_query_parallel
9.34s call tests/processing/test_data.py::test_read_metadata_from_file
8.63s call tests/processing/test_data.py::test_phonopy_data
8.22s call tests/app/v1/routers/test_uploads.py::test_post_upload[stream-no-name-embargoed]
7.98s call tests/datamodel/test_context.py::test_client_external_schema[external-references]
7.64s call tests/processing/test_base.py::test_queueing
7.58s call tests/processing/test_data.py::test_reuse_parser[False]
7.15s setup tests/normalizing/test_band_structure.py::test_non_standard
6.90s call tests/processing/test_data.py::test_reuse_parser[True]
6.11s setup tests/processing/test_data.py::test_re_process_staging[False-False]
6.08s call tests/app/v1/routers/test_uploads.py::test_post_upload[publish_directly]
5.67s call tests/app/test_resources.py::test_initial_get_resources
There is a single test which runs for the 25% of the whole runtime. Speeding up that single test might be useful.