mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Improve tests on Travis
This commit is contained in:
parent
a018c5b0f5
commit
75212cda3f
@ -81,16 +81,25 @@ def _get_unused_port():
|
|||||||
def server(request, loop, port_manager, monkeypatch):
|
def server(request, loop, port_manager, monkeypatch):
|
||||||
"""A GNS3 server"""
|
"""A GNS3 server"""
|
||||||
|
|
||||||
port = _get_unused_port()
|
|
||||||
host = "localhost"
|
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
for method, route, handler in Route.get_routes():
|
for method, route, handler in Route.get_routes():
|
||||||
app.router.add_route(method, route, handler)
|
app.router.add_route(method, route, handler)
|
||||||
for module in MODULES:
|
for module in MODULES:
|
||||||
instance = module.instance()
|
instance = module.instance()
|
||||||
instance.port_manager = port_manager
|
instance.port_manager = port_manager
|
||||||
|
|
||||||
|
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.create_server(app.make_handler(), host, port)
|
||||||
srv = loop.run_until_complete(srv)
|
srv = loop.run_until_complete(srv)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
def tear_down():
|
def tear_down():
|
||||||
for module in MODULES:
|
for module in MODULES:
|
||||||
|
Loading…
Reference in New Issue
Block a user