test_rollover_based_on_st_birthtime_only fails on slow CI: rotated file is outside the fixed 5-second search window
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
test_rollover_based_on_st_birthtime_only failed again on main, on the "Windows / Build and test (x64, tail-call)" CI job of 532b9dbd67 (2026-09-01): https://github.com/python/cpython/actions/runs/33523218872/job/99907492032
FAIL: test_rollover_based_on_st_birthtime_only (test.test_logging.TimedRotatingFileHandlerTest.test_rollover_based_on_st_birthtime_only)
AssertionError: False is not true : No rotated files found, went back 5 seconds
This is the test that gh-150960 (fixed by GH-150954, which widened the search from 5 to 6 timestamps) was about. The diagnostics the test prints show why it still fails on a slow machine:
Test time: 2026-09-01 15-10-51
The only matching files are: ['test_logging-2-p8i89g4b.log', 'test_logging-2-p8i89g4b.log.2026-09-01_15-10-45']
Contents of test_logging-2-p8i89g4b.log:
2026-09-01 15:10:51,079 testing - new record supposedly in the new file after rollover
Contents of test_logging-2-p8i89g4b.log.2026-09-01_15-10-45:
2026-09-01 15:10:45,004 testing - initial
2026-09-01 15:10:47,105 testing - update before rollover to renew the st_mtime
The rollover happened and is correct. The rotated file is named after the start of the interval, which is the creation time of the log file (TimedRotatingFileHandler.__init__() computes rolloverAt from min(creation_time, modification_time), and doRollover() uses rolloverAt - interval for the suffix), so its suffix is 15-10-45. The test then looks for a rotated file with a timestamp between now and now - 5 s. now was 15:10:51, six seconds after the file was created, because the third add_record() came 3.97 s after the second one instead of about 2.1 s. So the file with suffix 15-10-45 was one second outside the window.
The test's timing (two time.sleep(2.1) calls plus three handler set-ups and emits) is nominally 4.2 s, and any slowdown of more than 0.8 s pushes the rotated file out of the fixed 5-second window. The window should be derived from the time the test actually took, since the suffix can never be older than the moment the log file was created.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows (CI)
Linked PRs
- gh-157162
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
test.test_logging.TimedRotatingFileHandlerTest の test_rollover_based_on_st_birthtime_only から始め、Windows CI 構成で再現してください。テストが記録した時刻を基準にローテーションされたファイルをどのように検索しているかを確認し、既存の rollover 動作を検証してください。セットアップと出力に予想以上の時間がかかる場合でもテストの信頼性が保たれ、正しくローテーションされたファイルを引き続き検出できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- testing-qa
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100