2013-12-05 09:21:06 +02:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import pytest
|
|
|
|
import subprocess
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
|
|
def server(request):
|
2013-12-06 06:39:27 +02:00
|
|
|
"""
|
|
|
|
Starts GNS3 server for all the tests.
|
|
|
|
"""
|
2013-12-05 09:21:06 +02:00
|
|
|
|
|
|
|
cwd = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
server_script = os.path.join(cwd, "../gns3server/main.py")
|
|
|
|
process = subprocess.Popen([sys.executable, server_script, "--port=8000"])
|
2014-05-06 21:22:38 +03:00
|
|
|
time.sleep(1) # give some time for the process to start
|
2013-12-07 02:52:16 +02:00
|
|
|
request.addfinalizer(process.terminate)
|
2013-12-05 09:21:06 +02:00
|
|
|
return process
|