Stop server's event loop after test

This commit is contained in:
Anton Kortunov 2014-10-27 14:19:46 +04:00
parent 719c005f49
commit 65b49d5fec
2 changed files with 9 additions and 3 deletions

View File

@ -105,6 +105,7 @@ class OnlineReportPlugin(AbstractPlugin, Thread, AggregateResultListener):
# requests.get('http://localhost:8001/offline.html').text
# )
#raw_input('Press Enter to stop report server.')
self.server.stop()
del self.server
self.server = None
return retcode

View File

@ -91,11 +91,16 @@ class ReportServer(object):
)
def serve(self):
def run_server():
SocketServer(self.app)
th = Thread(target=run_server)
def run_server(server):
server.start()
self.server = SocketServer(self.app, auto_start = False)
th = Thread(target=run_server, args=(self.server,))
th.start()
def stop(self):
self.server.stop()
def send(self, data):
for connection in Client.CONNECTIONS:
data['uuid'] = self.reportUUID