Zero rerun delay can abort with OverflowError for a large finite backoff factor

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

@AryanRG đang làm issue này rồi.

Từ ngày 17/10/2026.

  • #389 của @AryanRG — đang mở

Đá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
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu với phép tính backoff tại src/pytest_rerunfailures.py:1340 và dùng bản tái hiện test_zero_backoff.py được cung cấp cùng lệnh pytest hiển thị trong issue. Kiểm tra cách xử lý độ trễ thực tế bằng không trước khi tính lũy thừa. Hoàn tất khi bản tái hiện thực hiện đủ cả bốn lần thử với mã thoát 0 và không có độ trễ trước các lần thử lại.

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

Mô tả

With zero rerun delay and a large positive, finite backoff factor, pytest aborts before using the configured retries.

Reproduced on macOS arm64, CPython 3.14.8 / pytest 9.1.1, against unmodified master 01fd226bd533ecd7f6aabe7c155c4ca7bcd8598c (16.8.dev0).

Save as test_zero_backoff.py:

def test_eventual_success(request):
    print(f"attempt {request.node.execution_count}")
    assert request.node.execution_count == 4
python -m pytest -q -s -p no:randomly -p no:cacheprovider \
  --reruns 3 --reruns-delay 0 --reruns-delay-backoff-factor 1e308 \
  test_zero_backoff.py

Expected: four attempts, 1 passed, 3 rerun, exit 0, with zero delay before each retry.

Actual: only three attempts, 2 rerun, then INTERNALERROR> OverflowError: (34, 'Result too large'), exit 3. At src/pytest_rerunfailures.py:1340, delay * delay_backoff_factor ** (item.execution_count - 1) evaluates 1e308 ** 2 before multiplying by zero.

1e308 is finite (math.isfinite(1e308) is true). This is an edge case with an unusually large factor; ordinary default settings are not affected. A local fix that skips exponentiation only for effective delay zero completes this reproduction with real sleep calls. Nonzero-delay overflow is outside this report's scope.

Disclosure: AI assistants were used for the investigation, reproduction, tests, review, and drafting with the account owner's authorization.

Ngôn ngữ chính
Python
Star
482
Fork
110
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

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 pytest-dev/pytest-rerunfailures

Tất cả issue của pytest-dev/pytest-rerunfailures

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.