Incompatible with pytest-timeout plugin

Đang mở
#99 6 bình luận 9 reaction 0 người được giao Xem trên GitHub

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

Từ ngày 17/9/2026.

  • #383 của @LouisDeconinck — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
testing-qa

Hướng nghiên cứu

Bắt đầu bằng cách chạy bản tái hiện pytester được cung cấp với pytest-rerunfailures và pytest-timeout, sau đó kiểm tra cách plugin xử lý các pytest hook liên quan đến việc chạy lại. Hoàn thành khi timeout được áp dụng lại trong lần chạy lại và bản tái hiện báo cáo một lần chạy lại và một test thất bại.

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

Mô tả

pytest-rerunfailures is not compatible with the pytest-timeout plugin.

Probably b/c the same pytest hooks are used. The first time, the timeout is observed, but when the test case re-runs, there's no timeout.

pytest-timeoutis more widely used and likely would be easier for the fix to be in this plugin if possible..

Here's a test that fails:

import pytest
pytest_plugins = 'pytester'

def test_pytest_timeout_compatibility_fails(testdir):
    """
    Verifies the `pytest-rerunfailures` plugin is compatible with `pytest-timeout`
    plugin when the test case is not done in the allotted time.
    """
    testdir.makepyfile(
        """
        import time
        import pytest
        @pytest.mark.flaky
        @pytest.mark.timeout(timeout=1)
        def test_times_out():
            time.sleep(2)
            assert True
        """
    )
    result = testdir.runpytest()
    outcome = result.parseoutcomes()
    assert outcome.get('rerun') == 1
    assert outcome.get('failed') == 1

When the test case re-runs, it ignores the timeout and passes.

Note: doesn't matter which decorator comes first (flaky or timeout), the behavior is the same.

Ngôn ngữ chính
Python
Star
481
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.