[BUG]: test_iostream is flaky on Windows (capfd captures empty output)

未关闭
#6,294 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
40/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
cpp, python
领域
testing

调研方向

Start in tests/test_iostream.py at test_redirect, test_redirect_err, test_redirect_reentry and test_err, the four cases named in the two failing jobs, and read the raw_output binding they call into before touching anything. Reproduce on a Windows runner (windows-2022, MSVC 2022 C++20, x64) with pytest tests/test_iostream.py run repeatedly, since the failure is intermittent and the cause is not yet known. Done means those tests stop returning empty output from capfd.readouterr() across repeated Windows CI runs; treat this as investigation first, so the outcome may be a fix in the test, the binding, or both.

由索引模型根据 Issue 内容生成。

描述

🤖 AI text below 🤖

tests/test_iostream.py fails intermittently on Windows CI. capfd.readouterr() returns an empty string for output written directly to std::cout / std::cerr. The failures are not related to the changes under test.

Occurrences:

  • PR #1043, 🐍 3.9 • MSVC 2022 C++20 • x64: test_redirect, test_redirect_err, test_redirect_reentry (job)
  • master at 0066b394 (scheduled run, 2026-11-18), ⚡ (windows-2022, 3.13): test_err (job)

Example:

    def test_redirect(capfd):
        msg = "Should not be in log!"
        stream = StringIO()
        with redirect_stdout(stream):
            m.raw_output(msg)
        stdout, _stderr = capfd.readouterr()
>       assert stdout == msg
E       AssertionError: assert '' == 'Should not be in log!'

All assertions that fail are on unredirected C++ stream output read through capfd. The cause is not known.

主要语言
C++
星标
18k
派生
2.3k
平均合并
5 天 7 小时
30 天内合并 PR
53

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pybind/pybind11 的其他 Issue

查看 pybind/pybind11 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。