Make TestAPIShutdown much like TestProcessShutdown
(this version should pass on Fedora)
This commit is contained in:
parent
66e8dbf621
commit
698123afec
|
@ -9,12 +9,14 @@ from .common import skip_python3
|
||||||
|
|
||||||
skip_python3()
|
skip_python3()
|
||||||
|
|
||||||
|
import psutil
|
||||||
|
|
||||||
try: # nosec
|
try: # nosec
|
||||||
from xmlrpclib import ServerProxy, ProtocolError
|
from xmlrpclib import ServerProxy, ProtocolError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from xmlrpc.client import ServerProxy, ProtocolError
|
from xmlrpc.client import ServerProxy, ProtocolError
|
||||||
|
|
||||||
from .test_process import TestProcessProto, TestProcessShutdown
|
from .test_process import TestProcessProto
|
||||||
|
|
||||||
|
|
||||||
class TestAPIProto(TestProcessProto):
|
class TestAPIProto(TestProcessProto):
|
||||||
|
@ -34,18 +36,16 @@ class TestAPIProto(TestProcessProto):
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
class TestAPIShutdown(TestAPIProto, TestProcessShutdown):
|
class TestAPIShutdown(TestAPIProto):
|
||||||
"""Separate test case for API command 'shutdown'"""
|
"""Separate test case for API command 'shutdown'"""
|
||||||
def test_shutdown(self):
|
def test_shutdown(self):
|
||||||
"""Shutdown the pybitmessage"""
|
"""Shutdown the pybitmessage"""
|
||||||
self.assertEqual(self.api.shutdown(), 'done')
|
self.assertEqual(self.api.shutdown(), 'done')
|
||||||
for _ in range(5):
|
try:
|
||||||
if not self.process.is_running():
|
self.process.wait(20)
|
||||||
break
|
except psutil.TimeoutExpired:
|
||||||
time.sleep(2)
|
|
||||||
else:
|
|
||||||
self.fail(
|
self.fail(
|
||||||
'%s has not stopped in 10 sec' % ' '.join(self._process_cmd))
|
'%s has not stopped in 20 sec' % ' '.join(self._process_cmd))
|
||||||
|
|
||||||
|
|
||||||
# TODO: uncovered API commands
|
# TODO: uncovered API commands
|
||||||
|
|
Reference in New Issue
Block a user