I am trying to get a way which can have a pytest function defined that checks the running time limit of python subprocesses.
I am trying to get a way which can have a pytest function defined that checks the running time limit of python subprocesses.
You cannot find out anything about the running time of a subprocess unless you actually run that subprocess, so I do not think this is a case for mocking.
Your test needs to
You can speed up the test by making sure it is notified (and then terminates successfully) as soon as the subprocess finishes.