I am trying to test a function that might crash, using multiprocessing.Process(). The code written below restarts the call if the function doesn't respond ideally within 10 minutes which is working completely fine, even the self.assert... tests are working fine. The problem comes out to be with the coverage, for some reason, running coverage over my files shows that my_func is being called but nothing inside it is getting covered while testing whereas the tests (which require the whole function to be executed without crashing) are passing.
while True:
p = multiprocessing.Process(
target=my_func, args=(return_dict) # return_dict to get the return values
)
p.start()
p.join(600)
if p.is_alive():
print(
"Taking too long, "
+ "KILLING IT and starting AGAIN."
)
p.kill()
p.join()
else:
break
Is there something that I am doing wrong? Please let me know if the information seems incomplete, I'll add my tests and the function then.