timeout does not terminate the test process when used with xdist
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- testing-qa
调研方向
从 test_simple_hang.py 中复现的测试开始,使用 thread 和 signal 两种 timeout 方法运行文档中说明的 pytest 命令。检查 timeout 在 --boxed 和 xdist 下的行为;完成的标准是,发生 timeout 的测试进程会终止并释放其资源,而不是继续保持活动状态。
由索引模型根据 Issue 内容生成。
描述
Summary
running pytest-timeout with pytest-xdist doesn't terminate the test process.
This creates an issue if I would like to test a long-running computation-intensive function: the test process keeps running even after the timeout and the resources are not released until I manually kill the process.
Some version info from pytest
platform darwin -- Python 3.7.6, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
rootdir: /private/tmp/test_hang
plugins: cov-2.10.0, xdist-1.34.0, timeout-1.4.2, forked-1.3.0
timeout: 10.0s
timeout method: thread
timeout func_only: False
To reproduce
Create a simple test case (test_simple_hang.py) like this:
import time
import os
def test():
print(os.getpid())
time.sleep(60)
Running the following command:
pytest --timeout=10 --boxed --timeout_method=thread test_simple_hang.py
After the timeout, if I do ps -ef | grep <pid>, the process remains active.
It also occurs when --timeout_method=signal.
- 主要语言
- Python
- 星标
- 260
- 派生
- 70
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pytest-dev/pytest-timeout 的其他 Issue
-
PR #200 introduced breaking change - `timeout` value in config is incompatible with older versions可能已有人在做 @Sanjays2402 于 44 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 48/100
pytest-dev/pytest-timeout#203 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
pytest-dev/pytest-timeout#190 · 9 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
pytest-dev/pytest-timeout#189 ·
-
难度 2/5 1-3 小时 新手友好度 35/100
pytest-dev/pytest-timeout#181 · 4 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 35/100
pytest-dev/pytest-timeout#178 · 1 条评论 ·
查看 pytest-dev/pytest-timeout 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
UKGovernmentBEIS/inspect_ai#5802 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
no-human-ai/no_human#660 ·
维护者通常 1 天内回复
-
documentation good first issue
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
documentation need help question
难度 1/5 1-3 小时 新手友好度 66/100
phonology024/babelscribe#26 ·
-
bug
难度 2/5 1-3 小时 新手友好度 62/100