Test SIGTERM signal handling

This commit is contained in:
Dmitri Bogomolov 2019-03-07 12:18:45 +02:00
parent c38d250389
commit acea683139
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -89,6 +89,24 @@ class TestProcessProto(unittest.TestCase):
len(self.process.threads()), self._threads_count) len(self.process.threads()), self._threads_count)
class TestProcessShutdown(TestProcessProto):
"""Separate test case for SIGTERM"""
def test_shutdown(self):
"""Send to pybitmessage SIGTERM and ensure it stopped"""
self.process.send_signal(signal.SIGTERM)
try:
# longer wait time because it's not a benchmark
self.process.wait(10)
except psutil.TimeoutExpired:
self.fail(
'%s has not stopped in 10 sec' % ' '.join(self._process_cmd))
@classmethod
def tearDownClass(cls):
"""Special teardown because pybitmessage is already stopped"""
cls._cleanup_files()
class TestProcess(TestProcessProto): class TestProcess(TestProcessProto):
"""A test case for pybitmessage process""" """A test case for pybitmessage process"""
def test_process_name(self): def test_process_name(self):