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

Fix tests on MacOS

This commit is contained in:
Julien Duponchelle 2015-02-27 18:30:22 +01:00
parent 38326f7d72
commit ae7bf828cd
3 changed files with 11 additions and 6 deletions

View File

@ -15,6 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys import sys
import os
from gns3server.handlers.api.version_handler import VersionHandler from gns3server.handlers.api.version_handler import VersionHandler
from gns3server.handlers.api.network_handler import NetworkHandler from gns3server.handlers.api.network_handler import NetworkHandler
from gns3server.handlers.api.project_handler import ProjectHandler from gns3server.handlers.api.project_handler import ProjectHandler
@ -25,5 +27,6 @@ from gns3server.handlers.api.virtualbox_handler import VirtualBoxHandler
from gns3server.handlers.api.vpcs_handler import VPCSHandler from gns3server.handlers.api.vpcs_handler import VPCSHandler
from gns3server.handlers.upload_handler import UploadHandler from gns3server.handlers.upload_handler import UploadHandler
if sys.platform.startswith("linux"): print(os.environ)
if sys.platform.startswith("linux") or hasattr(sys, "_called_from_test"):
from gns3server.handlers.api.iou_handler import IOUHandler from gns3server.handlers.api.iou_handler import IOUHandler

View File

@ -23,7 +23,7 @@ from .qemu import Qemu
MODULES = [VPCS, VirtualBox, Dynamips, Qemu] MODULES = [VPCS, VirtualBox, Dynamips, Qemu]
if sys.platform.startswith("linux"): if sys.platform.startswith("linux") or hasattr(sys, "_called_from_test"):
# IOU runs only on Linux # IOU runs only on Linux
from .iou import IOU from .iou import IOU
MODULES.append(IOU) MODULES.append(IOU)

View File

@ -15,14 +15,20 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import pytest import pytest
import socket import socket
import asyncio import asyncio
import tempfile import tempfile
import shutil import shutil
import os import os
import sys
from aiohttp import web from aiohttp import web
sys._called_from_test = True
# Prevent execution of external binaries
os.environ["PATH"] = tempfile.mkdtemp()
from gns3server.config import Config from gns3server.config import Config
from gns3server.web.route import Route from gns3server.web.route import Route
# TODO: get rid of * # TODO: get rid of *
@ -33,10 +39,6 @@ from gns3server.modules.project_manager import ProjectManager
from tests.handlers.api.base import Query from tests.handlers.api.base import Query
# Prevent execution of external binaries
os.environ["PATH"] = tempfile.mkdtemp()
@pytest.yield_fixture @pytest.yield_fixture
def restore_original_path(): def restore_original_path():
""" """