Skip to content

Commit

Permalink
Update tests/visualization_tests/test_timeline.py
Browse files Browse the repository at this point in the history
  • Loading branch information
eukaryo authored and gen740 committed Jul 12, 2024
1 parent 8136f41 commit 9b5c863
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/visualization_tests/test_timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ def _objective_with_sleep(trial: optuna.Trial) -> float:
# Spin waiting is used here because high accuracy is necessary even in weak VM.
# Please check the motivation of the bugfix in https://github.com/optuna/optuna/pull/5549/
while datetime.datetime.now() - sleep_start_datetime < datetime.timedelta(seconds=0.1):
# `sleep(0.1)` is only guaranteed to rest for more than 0.1 second; the actual time
# depends on the OS. spin waiting is used here to rest for 0.1 second as precisely as
# possible without voluntarily releasing the context.
pass
assert datetime.datetime.now() - sleep_start_datetime < datetime.timedelta(seconds=0.19)
trial.suggest_float("x", -1.0, 1.0)
Expand Down

0 comments on commit 9b5c863

Please sign in to comment.