Skip to content
New issue

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

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

Already on GitHub? # to your account

Add pytest fixture to limit max time a test can take #475

Open
deependujha opened this issue Feb 17, 2025 · 2 comments
Open

Add pytest fixture to limit max time a test can take #475

deependujha opened this issue Feb 17, 2025 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@deependujha
Copy link
Collaborator

🐛 Bug

To Reproduce

Steps to reproduce the behavior...

Code sample
# Ideally attach a minimal code sample to reproduce the decried issue.
# Minimal means having the shortest code but still preserving the bug.

Expected behavior

If a test hangs that doesn't have a timeout limit, it'll hang forever. PR #473 was very slow (probably hanging and not progressing). With an autouse fixture, we can set a max timeout of 10 minute or something appropriate.

Additional context

Environment detail
  • PyTorch Version (e.g., 1.0):
  • OS (e.g., Linux):
  • How you installed PyTorch (conda, pip, source):
  • Build command you used (if compiling from source):
  • Python version:
  • CUDA/cuDNN version:
  • GPU models and configuration:
  • Any other relevant information:
@deependujha deependujha added bug Something isn't working help wanted Extra attention is needed labels Feb 17, 2025
@deependujha
Copy link
Collaborator Author

my bad. The test passed, but still, should we have a default max time limit?

https://stackoverflow.com/questions/43598985/how-can-i-set-a-default-per-test-timeout-in-pytest

cc: @tchaton @bhimrazy

@bhimrazy
Copy link
Collaborator

For a global max limit, 10 to 20 minutes seems reasonable to me.
And when needed, we can apply the timeout at the test level for specific functions using @pytest.mark.timeout(...).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants