1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 17:06:17 +00:00

Try to fix stalling tests

This commit is contained in:
Alban Féron 2021-12-04 17:43:08 +01:00
parent 09802aedaf
commit 430d5a0dad
No known key found for this signature in database
GPG Key ID: 8CE0313646D16165
2 changed files with 3 additions and 1 deletions

View File

@ -106,8 +106,8 @@ class Daemon:
self.__watcher.remove_folder(folder.path) self.__watcher.remove_folder(folder.path)
def terminate(self): def terminate(self):
self.__stopped.set()
with Client(self.__listener.address, authkey=self.__listener._authkey) as c: with Client(self.__listener.address, authkey=self.__listener._authkey) as c:
self.__stopped.set()
c.send(None) c.send(None)
if self.__scanner is not None: if self.__scanner is not None:

View File

@ -6,6 +6,7 @@
# Distributed under terms of the GNU AGPLv3 license. # Distributed under terms of the GNU AGPLv3 license.
from pony.orm import db_session from pony.orm import db_session
from time import sleep
from threading import Thread from threading import Thread
from supysonic.daemon.server import Daemon from supysonic.daemon.server import Daemon
@ -37,6 +38,7 @@ class ScanWithDaemonTestCase(ApiTestBase):
self._daemon = Daemon(self.config) self._daemon = Daemon(self.config)
self._thread = Thread(target=self._daemon.run) self._thread = Thread(target=self._daemon.run)
self._thread.start() self._thread.start()
sleep(0.2) # Wait a bit for the daemon thread to initialize
def tearDown(self): def tearDown(self):
self._daemon.terminate() self._daemon.terminate()