Skip to content

capture windows stdout - #6699

Merged
y0z merged 1 commit into
optuna:masterfrom
gen740:fix_windows_ci
Jun 4, 2026
Merged

y0z merged 1 commit into
optuna:masterfrom
gen740:fix_windows_ci

Conversation

@gen740

@gen740 gen740 commented May 31, 2026 •

Copy link
Copy Markdown
Member

Motivation

In the current Windows tests, Optuna logging output is not properly captured by pytest. This happens because optuna.logging can bind its default stream before pytest redirects/captures stderr, and the logging handler then keeps that stale stream
reference throughout the test run.

As a result, the windows-tests CI output contains a large amount of noisy log output instead of the usual compact pytest progress output, for example:

Uninstalled 1 package in 51ms
Installed 1 package in 289ms
[I 2026-05-31 12:27:03,819] A new study created in memory with name: no-name-812ffc68-2d92-405b-94bd-65af4c7c5e22
[I 2026-05-31 12:27:03,827] A new study created in memory with name: no-name-fed26276-bc8c-4739-bd64-bac6468fa548
[I 2026-05-31 12:27:03,828] Trial 0 finished with values: [1.0, 2.0] and parameters: {'x': 1, 'y': 2}.
[I 2026-05-31 12:27:03,828] Trial 1 finished with values: [1.0, 1.0] and parameters: {'x': 1, 'y': 1}.
[I 2026-05-31 12:27:03,828] Trial 2 finished with values: [0.0, 2.0] and parameters: {'x': 0, 'y': 2}.
[I 2026-05-31 12:27:03,828] Trial 3 finished with values: [1.0, 0.0] and parameters: {'x': 1, 'y': 0}.

This makes Windows CI logs harder to inspect compared with Linux and macOS, where pytest capture works as expected.

Description of the changes

  • Reconfigured Optuna's default logging handler during pytest setup on Windows so that it uses pytest's captured stream.

@c-bata c-bata added the CI Continuous integration. label Jun 3, 2026

@c-bata c-bata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@y0z
y0z merged commit 2523542 into optuna:master Jun 4, 2026
13 checks passed
@y0z y0z added this to the v5.0.0 milestone Jun 4, 2026
@gen740
gen740 deleted the fix_windows_ci branch June 4, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous integration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants