Fix test_no_optuna reinstalling optuna at wrong version#1522
Merged
Conversation
test_no_optuna() uninstalls optuna to test graceful handling, then reinstalls it. It was hardcoded to reinstall optuna==2.8.0 instead of the version range used elsewhere (>=2.8.0,<=3.6.1), leaving the test environment with a downgraded optuna for the rest of the CI run. This caused the saved dependency snapshot to incorrectly report optuna==2.8.0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a CI/test environment issue in FLAML’s tuning test suite by ensuring test_no_optuna() restores Optuna using the same compatibility range declared in FLAML’s optional dependencies, preventing unintended dependency downgrades from being captured in CI snapshots.
Changes:
- Update
test_no_optuna()to reinstall Optuna usingoptuna>=2.8.0,<=3.6.1instead of pinningoptuna==2.8.0.
jianglibigdata
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why are these changes needed?
The
test_no_optuna()test intest/tune/test_searcher.pyuninstalls optuna to verify graceful handling when it is missing, then reinstalls it. However, it was hardcoded to reinstalloptuna==2.8.0instead of using the version range specified elsewhere (>=2.8.0,<=3.6.1).Since this test runs before the "Save dependencies" CI step,
pip freezecaptured the downgraded version, causing the saved dependency snapshot to incorrectly reportoptuna==2.8.0instead of3.6.1.The fix changes the reinstall command from
optuna==2.8.0tooptuna>=2.8.0,<=3.6.1so the latest compatible version is restored after the test.Related issue number
N/A
Checks