tests: Warn about processes which don't exit cleanly

This commit is contained in:
Florian Bruhin 2020-11-10 18:46:27 +01:00
parent 43d40a8833
commit 3126ce6686
2 changed files with 6 additions and 1 deletions

View File

@ -81,4 +81,5 @@ filterwarnings =
error
# See https://github.com/HypothesisWorks/hypothesis/issues/2370
ignore:.*which is reset between function calls but not between test cases generated by:hypothesis.errors.HypothesisDeprecationWarning
default:Test process .* failed to terminate!:UserWarning
faulthandler_timeout = 90

View File

@ -22,6 +22,7 @@
import re
import os
import time
import warnings
import attr
import pytest
@ -316,8 +317,11 @@ class Process(QObject):
else:
self.proc.terminate()
ok = self.proc.waitForFinished()
ok = self.proc.waitForFinished(5000)
if not ok:
cmdline = ' '.join([self.proc.program()] + self.proc.arguments())
warnings.warn(f"Test process {cmdline} with PID {self.proc.processId()} "
"failed to terminate!")
self.proc.kill()
self.proc.waitForFinished()