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

Đang mở Phù hợp với người mới
#654 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
testing-qa

Hướng nghiên cứu

Bắt đầu với test_capture_pane_flags[join_wrapped_numbers] và kiểm tra command_complete() được nêu trong issue. Tái hiện lỗi xảy ra không liên tục, đảm bảo marker chỉ được phát hiện từ đầu ra của lệnh chứ không phải từ phần echo của lệnh shell, rồi chạy test được nêu tên để xác nhận rằng test luôn pass ổn định.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
1.2k
Fork
127
Merge trung bình
2 giờ 13 phút
Pull request đã merge (30 ngày)
1

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của tmux-python/libtmux

Tất cả issue của tmux-python/libtmux

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.