The unit test test_dense_image_warp hangs sometimes. I ran it locally 1000 times and I wasn't able to reproduce the error.
This PR adds a timeout to the unit tests, so that we get a stack trace the next time it stalls. Also it doesn't waste 6 hours of compute.
The timeout is set to 5 minutes per test by default.
Changes
Adds pytest timeout with the default timeout of 5 minutes.
Decorate test_dense_image_warp to make sure that a proper stack trace is printed on the next timeout.
Testing
Tested locally, I saw a stack trace on a timeout:
File "/private/home/marton/miniconda3/envs/waveenv/lib/python3.10/site-packages/pluggy/_manager.py", line 119, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/private/home/marton/miniconda3/envs/waveenv/lib/python3.10/site-packages/pluggy/_callers.py", line 102, in _multicall
res = hook_impl.function(*args)
File "/private/home/marton/.local/lib/python3.10/site-packages/_pytest/python.py", line 194, in pytest_pyfunc_call
result = testfunction(**testargs)
File "/private/home/marton/NeuralCompressionInternal/tests/functional/test_dense_image_warp.py", line 17, in test_dense_image_warp
time.sleep(10)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Timeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The unit test test_dense_image_warp hangs sometimes. I ran it locally 1000 times and I wasn't able to reproduce the error.
This PR adds a timeout to the unit tests, so that we get a stack trace the next time it stalls. Also it doesn't waste 6 hours of compute.
The timeout is set to 5 minutes per test by default.
Changes
Testing
Tested locally, I saw a stack trace on a timeout: