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

Updated pytest-timeout changes internal functions

Đang mở
#1,620 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
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả 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 với tests/logs.py và tests/pytest_hooks.py, sau đó so sánh cách chúng sử dụng pytest-timeout với các thay đổi API của 2.3.0 được mô tả trong issue. Chạy các bài kiểm thử debugpy liên quan; được xem là hoàn tất khi cả hai tích hợp kiểm thử bị ảnh hưởng đều hoạt động với pytest-timeout 2.3.0 mà không dựa vào hàm đã bị loại bỏ hoặc bỏ qua đối số mới.

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

Mô tả

bug

pytest-timeout version 2.3.0 has changed two internal functions that debugpy uses in its tests:

  • write_title() has been removed (used in tests/logs.py)
  • dump_stacks() now takes an argument (terminal)

I have addressed the first one in Debian in a hackish way:

--- a/tests/logs.py                                                             
+++ b/tests/logs.py                                                             
@@ -4,7 +4,7 @@                                                                 
                                                                                
 import io                                                                      
 import os                                                                      
-import pytest_timeout                                                          
+from _pytest._io import TerminalWriter                                         
 import sys                                                                     
                                                                                
 from debugpy.common import json, log                                           
@@ -27,5 +27,6 @@                                                               
                 pass                                                           
             else:                                                              
                 path = os.path.relpath(path, log.log_dir)                      
-                pytest_timeout.write_title(path)                               
+                out = TerminalWriter()                                         
+                out.sep("+", title=path)                                       
                 print(s, file=sys.stderr)                                      

but see https://github.com/pytest-dev/pytest/issues/10436 for a warning about this approach. For the second, I've done this:

--- a/tests/pytest_hooks.py                                                     
+++ b/tests/pytest_hooks.py                                                     
@@ -61,4 +61,4 @@                                                               
 # we want to print the pydevd log as well. This is not a normal pytest hook - \
we                                                                              
 # just detour pytest_timeout.dump_stacks directly.                             
 _dump_stacks = pytest_timeout.dump_stacks                                      
-pytest_timeout.dump_stacks = lambda: (_dump_stacks(), logs.dump())             
+pytest_timeout.dump_stacks = lambda term: (_dump_stacks(term), logs.dump())    
Ngôn ngữ chính
Python
Star
2.5k
Fork
202
Merge trung bình
5 ngày 1 giờ
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 microsoft/debugpy

Tất cả issue của microsoft/debugpy

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.