Skip to content

[MNT] Diagnose and address long test runtimes (#1633)#1692

Open
Abhishek9639 wants to merge 1 commit intoopenml:mainfrom
Abhishek9639:mnt/diagnose-long-test-runtimes
Open

[MNT] Diagnose and address long test runtimes (#1633)#1692
Abhishek9639 wants to merge 1 commit intoopenml:mainfrom
Abhishek9639:mnt/diagnose-long-test-runtimes

Conversation

@Abhishek9639
Copy link

Fixes #1633

Changes

Current CI test runs take 1–2+ hours. This PR diagnoses the bottleneck and implements several improvements:

Root Cause

The production_server tests (74 tests) make live API calls to openml.org, taking ~1h 23m in CI even with 4-worker parallelization.

Improvements

  1. Global per-test timeout (pyproject.toml)

    • Added timeout = 600 (10 min) to [tool.pytest.ini_options]
    • Prevents any single test from hanging indefinitely
  2. CI workflow improvements (.github/workflows/test.yml)

    • Changed --durations=20--durations=0 to report ALL test durations for diagnosis
    • Added explicit --timeout=600 to all 3 pytest invocations
  3. Fixture optimization (tests/conftest.py)

    • Changed verify_cache_state fixture scope from functionmodule
    • Reduces redundant filesystem I/O (was running before/after EVERY test)
  4. Benchmark script (scripts/profile_tests.sh)

    • New script for easy local test duration profiling
    • Configurable marker filters

Test Distribution Analysis

Category Count CI Time
All tests 368
production_server 74 ~1h 23m (bottleneck)
test_server 196 excluded from CI
sklearn-only 6 ~1 min
Non-server 99 fast

Verification

  • All pre-commit checks pass (ruff, ruff-format, mypy)
  • All 368 tests still collect correctly

- Add global per-test timeout (600s) to pytest config
- CI: report all test durations (--durations=0) for diagnosis
- CI: add explicit --timeout=600 to prevent hanging tests
- Optimize verify_cache_state fixture: scope function -> module
- Add scripts/profile_tests.sh for local duration profiling
@Abhishek9639
Copy link
Author

Abhishek9639 commented Feb 26, 2026

Hii @geetu040 and @fkiraly,
Fixed the code quality checks. All pre-commit checks are now passing.
Please review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MNT] diagnose and address long test runtimes

1 participant