litdata icon indicating copy to clipboard operation
litdata copied to clipboard

Add pytest fixture to limit max time a test can take

Open deependujha opened this issue 10 months ago • 2 comments

🐛 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 avatar Feb 17 '25 21:02 deependujha

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

deependujha avatar Feb 18 '25 05:02 deependujha

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(...).

bhimrazy avatar Feb 18 '25 07:02 bhimrazy

Closing this issue — the global max time limit is already handled in CI:

https://github.com/Lightning-AI/litData/blob/1a0f48c4a9bcda6b0afe7f8d0d39dc678557f5cf/.github/workflows/ci-testing.yml#L24-L25

bhimrazy avatar Jun 03 '25 20:06 bhimrazy