The parameterized tests in test_definitions.py run slower than needed since all 169 YAML files are loaded for each test case. We can speed this up significantly by loading them once and reusing the resulting list of dicts.
Motivation
Faster unit tests.
Exemplification
On my machine, the execution time for tox -e pytest decreased from 9 s to 3 s after this optimization.
Description
The parameterized tests in test_definitions.py run slower than needed since all 169 YAML files are loaded for each test case. We can speed this up significantly by loading them once and reusing the resulting list of dicts.
Motivation
Faster unit tests.
Exemplification
On my machine, the execution time for
tox -e pytest
decreased from 9 s to 3 s after this optimization.Benefits
Faster unit tests.
Possible Drawbacks
Slightly more complex test code.