[Tests] Ensure tear_down deletes rpcserver and core

This commit is contained in:
Calum Lind 2018-05-19 21:23:46 +01:00
parent a7c7309027
commit 0c574f33e1
2 changed files with 13 additions and 4 deletions

View File

@ -37,14 +37,18 @@ class TorrentTestCase(BaseTestCase):
def set_up(self): def set_up(self):
self.setup_config() self.setup_config()
RPCServer(listen=False) self.rpcserver = RPCServer(listen=False)
self.core = Core() self.core = Core()
self.session = lt.session() self.session = lt.session()
self.torrent = None self.torrent = None
return component.start() return component.start()
def tear_down(self): def tear_down(self):
return component.shutdown() def on_shutdown(result):
del self.rpcserver
del self.core
return component.shutdown().addCallback(on_shutdown)
def print_priority_list(self, priorities): def print_priority_list(self, priorities):
tmp = '' tmp = ''

View File

@ -29,12 +29,17 @@ class TorrentmanagerTestCase(BaseTestCase):
def set_up(self): def set_up(self):
common.set_tmp_config_dir() common.set_tmp_config_dir()
RPCServer(listen=False) self.rpcserver = RPCServer(listen=False)
self.core = Core() self.core = Core()
return component.start() return component.start()
def tear_down(self): def tear_down(self):
return component.shutdown()
def on_shutdown(result):
del self.rpcserver
del self.core
return component.shutdown().addCallback(on_shutdown)
@defer.inlineCallbacks @defer.inlineCallbacks
def test_remove_torrent(self): def test_remove_torrent(self):