Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

hanging when I use --time-methid=signal

Đang mở
#173 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/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

Tái hiện hiện tượng treo bằng vòng lặp pytest.main được示 và --timeout-method=signal, sau đó kiểm tra đầu ra timeout từ iree/tests/e2e/dlc_specific/test_runner.py, đặc biệt là thread_task, run_test, run_in_backend và subprocess.run. Theo dõi cách worker và subprocess bị timeout được xử lý; hoàn thành có nghĩa là một trường hợp bị timeout trả quyền điều khiển về vòng lặp và trường hợp kiểm thử tiếp theo chạy mà không khiến tiến trình bị treo.

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

Mô tả

i am making a unittest,
`for index, test_case in enumerate(test_cases[start_case_index:], start=start_case_index):
test_case_name = test_case.split("::")[-1]
print(f"Running {test_case_name}")

    pytest.main(['-v', '--tb=short', '--capture=no', '--timeout=20', '--timeout-method=signal', test_case], plugins=[recorder])
    
    result_data = recorder.results.get(test_case)
    if result_data is None:
        result_data = {
            "outcome": "not executed",
            "duration": 0,
            "timestamp": datetime.now().isoformat()
        }`

above is my test code, if one case is out of time, the process will hang and show log like below and would not break out to next test case,what shoukd I do?
++++++++++++++++++++++++++++++++++++++++++++++ Timeout ++++++++++++++++++++++++++++++++++++++++++++++

  File "/usr/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 83, in _worker
    work_item.run()
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/workspace/bailuan/20240105_iree_chiptech/iree/tests/e2e/dlc_specific/test_runner.py", line 461, in thread_task
    result = run_test(fn, inputs, output_num, global_config_path,
  File "/workspace/bailuan/20240105_iree_chiptech/iree/tests/e2e/dlc_specific/test_runner.py", line 428, in run_test
    output_fns1 = run_in_backend("dlc")
  File "/workspace/bailuan/20240105_iree_chiptech/iree/tests/e2e/dlc_specific/test_runner.py", line 406, in run_in_backend
    run_result = subprocess.run(
  File "/usr/lib/python3.10/subprocess.py", line 505, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "/usr/lib/python3.10/subprocess.py", line 1154, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.10/subprocess.py", line 2021, in _communicate
    ready = selector.select(timeout)
  File "/usr/lib/python3.10/selectors.py", line 416, in select
    fd_event_list = self._selector.poll(timeout)
++++++++++++++++++++++++++++++++++++++++++++++ Timeout ++++++++++++++++++++++++++++++++++++++++++++++
Ngôn ngữ chính
Python
Star
260
Fork
70
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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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-timeout

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

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.