[Tests] Make sure to return exit code still when ending test daemon

Use a separate Client instance to call test daemon shutdown
This commit is contained in:
Chase Sterling 2022-01-26 10:25:43 -05:00 committed by Calum Lind
parent 4497c9bbcc
commit 986375fa86
No known key found for this signature in database
GPG Key ID: 90597A687B836BA3
1 changed files with 4 additions and 2 deletions

View File

@ -21,7 +21,7 @@ import deluge.core.preferencesmanager
import deluge.log import deluge.log
from deluge.common import get_localhost_auth from deluge.common import get_localhost_auth
from deluge.error import DelugeError from deluge.error import DelugeError
from deluge.ui.client import client from deluge.ui.client import Client
# This sets log level to critical, so use log.critical() to debug while running unit tests # This sets log level to critical, so use log.critical() to debug while running unit tests
deluge.log.setup_logger('none') deluge.log.setup_logger('none')
@ -156,7 +156,8 @@ class ProcessOutputHandler(protocol.ProcessProtocol):
yield shutdown yield shutdown
except Exception: except Exception:
self.transport.signalProcess('TERM') self.transport.signalProcess('TERM')
yield self.quit_d result = yield self.quit_d
return result
def _kill_watchdogs(self): def _kill_watchdogs(self):
""""Cancel all watchdogs""" """"Cancel all watchdogs"""
@ -305,6 +306,7 @@ except Exception:
@defer.inlineCallbacks @defer.inlineCallbacks
def shutdown_daemon(): def shutdown_daemon():
username, password = get_localhost_auth() username, password = get_localhost_auth()
client = Client()
yield client.connect( yield client.connect(
'localhost', listen_port, username=username, password=password 'localhost', listen_port, username=username, password=password
) )