MAINT: Unit test and pre-commit speedup #1227
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
pre-commit jupyter build: (pre) 47 seconds ---> 1 second
Changed local validation to run a lightweight script that only checks _toc.yml and api.rst for errors, rather than building the full Jupyter Book website. Full website builds still run in CI. Set this to only run the full build if an environment variable is present.
pre-commit check-links: (pre) 20 seconds ---> 12 seconds
Added parallelism when checking links across documentation files and increased the number of threads for concurrent link validation.
make unit-test parall: (pre) 266 seconds ---> 109 seconds (parallel)
Switched from sequential to parallel test execution using pytest -n 4. Tested with -n auto but found -n 4 more consistent and reliable. Fixed several tests to be compatible with parallel execution (addressed fixture scoping and shared state issues). However, this can vary more than sequential tests depending on laptop load.
updating slowest tests: (pre) 109 seconds parallel -> 96 seconds
Mocked asyncio.sleep in tests that were waiting for rate limiting (6s), retry delays in translation converter (6s), and net utility retries (~3s). Added 2 lightweight integration tests to verify actual timing behavior (exponential backoff and rate limiting). The ~15s sequential savings translates to ~13s wall-time improvement with parallel execution due to work distribution across workers.