Skip to content

test: move type-only imports in optuna.testing.samplers behind TYPE_CHECKING - #6541

Merged
c-bata merged 2 commits into
optuna:masterfrom
t7r0n:fix/type-checking-testing-samplers-6029
Mar 23, 2026
Merged

c-bata merged 2 commits into
optuna:masterfrom
t7r0n:fix/type-checking-testing-samplers-6029

Conversation

@t7r0n

@t7r0n t7r0n commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • move type-only imports in optuna/testing/samplers.py into a TYPE_CHECKING block
  • keep runtime behavior unchanged while satisfying Ruff TCH checks

Motivation

Testing

  • uv run ruff check optuna/testing/samplers.py --select TCH
  • uv run ruff check optuna/testing/samplers.py
  • uv run ruff format --check optuna/testing/samplers.py
  • uv run mypy optuna/testing/samplers.py
  • uv run pytest tests/trial_tests/test_trial.py -q

Part of #6029

@t7r0n

t7r0n commented Mar 20, 2026

Copy link
Copy Markdown
Contributor Author

Pushed an empty commit to retrigger CI after a flaky failure in (progress-bar assertion).

@t7r0n

t7r0n commented Mar 20, 2026

Copy link
Copy Markdown
Contributor Author

Pushed an empty commit to retrigger CI after a flaky progress-bar assertion failure in tests/study_tests/test_study.py::test_optimize_progbar_n_trials_prioritized.

@c-bata c-bata added the code-fix Change that does not change the behavior, such as code refactoring. label Mar 23, 2026
@c-bata c-bata added this to the v4.9.0 milestone Mar 23, 2026
@c-bata
c-bata merged commit 369e847 into optuna:master Mar 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-fix Change that does not change the behavior, such as code refactoring.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants