Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Updated pytest-timeout changes internal functions

未关闭
#1,620 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
testing-qa

调研方向

从 tests/logs.py 和 tests/pytest_hooks.py 开始,然后将它们对 pytest-timeout 的使用方式与 issue 中描述的 2.3.0 API 变更进行比较。运行相关的 debugpy 测试;当受影响的两个测试集成都能在 pytest-timeout 2.3.0 下工作,且不依赖已移除的函数或省略新参数时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

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())    
主要语言
Python
星标
2.5k
派生
202
平均合并
5 天 1 小时
30 天内合并 PR
1

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/debugpy 的其他 Issue

查看 microsoft/debugpy 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。