I have a function which sometimes goes into the infinite loop.
I want to write an integration test to check that that doesn't happen; i.e. the functions is too big/complex to modify, so testing has to be external.
Basically, I know that it should always finish within x
amount of time, if it takes more than x
, it is in an infinite loop.
I'm using pytest
as my testing framework. Is there a simple way to set a timer for functions execution?
I roughly understand how I can do it with threads/processes, but I was wondering if there is an existing approach.