Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeout does not terminate the test process when used with xdist #72

Open
leeyeetonn opened this issue Aug 4, 2020 · 1 comment
Open

Comments

@leeyeetonn
Copy link

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.

@abyss7
Copy link

abyss7 commented Sep 30, 2020

Is it related with pytest-dev/pytest#6887 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants