Flaky test: test_capture_pane_flags[join_wrapped_numbers] matches marker in command echo

未关闭 适合新手
#654 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
python
领域
testing-qa

调研方向

从 test_capture_pane_flags[join_wrapped_numbers] 和 issue 中展示的 command_complete() 检查开始。重现间歇性失败,确保 marker 仅从命令输出中检测,而不是从 shell 命令回显中检测,然后运行指定的测试以确认它能够可靠地通过。

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

描述

Bug

test_capture_pane_flags[join_wrapped_numbers] fails intermittently because the completion marker is detected in the shell command echo line before the command actually executes.

Root cause

The command_complete() check uses:

def command_complete() -> bool:
    output = "\n".join(pane.capture_pane())
    return marker in output

This matches the marker string inside the prompt echo ($ printf ... echo "__DONE_join_wrapped_numbers__") — a false positive. The shell echoes the full command before executing it, so the marker appears in the pane buffer before seq produces any output.

Expected behavior

The marker should only be detected when it appears as command output (its own line), not as part of the typed command echo.

Fix

Change the check to skip lines that start with the shell prompt ($):

def command_complete() -> bool:
    lines = pane.capture_pane()
    return any(marker in line and not line.lstrip().startswith("$") for line in lines)

Reproduction

The failure is timing-dependent. On fast systems seq completes before the next capture, masking the bug. On slower systems or CI, the race is more visible.

主要语言
Python
星标
1.2k
派生
127
平均合并
2 小时 13 分钟
30 天内合并 PR
1

贡献指南

打开贡献指南

从这里开始

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

tmux-python/libtmux 的其他 Issue

查看 tmux-python/libtmux 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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