1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-13 20:08:55 +00:00

Improve tests on Travis

This commit is contained in:
Julien Duponchelle 2016-03-16 16:34:16 +01:00
parent a018c5b0f5
commit 75212cda3f
No known key found for this signature in database
GPG Key ID: F1E2485547D4595D

View File

@ -81,16 +81,25 @@ def _get_unused_port():
def server(request, loop, port_manager, monkeypatch):
"""A GNS3 server"""
port = _get_unused_port()
host = "localhost"
app = web.Application()
for method, route, handler in Route.get_routes():
app.router.add_route(method, route, handler)
for module in MODULES:
instance = module.instance()
instance.port_manager = port_manager
srv = loop.create_server(app.make_handler(), host, port)
srv = loop.run_until_complete(srv)
host = "localhost"
# We try multiple time. Because on Travis test can fail when because the port is taken by someone else
for i in range(0, 5):
port = _get_unused_port()
try:
srv = loop.create_server(app.make_handler(), host, port)
srv = loop.run_until_complete(srv)
except OSError:
pass
else:
break
def tear_down():
for module in MODULES: