From 4df95efdec9018a065b6179c18dc7ffdc1834d7a Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 27 Apr 2015 15:09:42 +0200 Subject: [PATCH] Skip IOU test on Windows Fix #159 --- README.rst | 3 +++ gns3server/modules/__init__.py | 8 +++++--- tests/handlers/api/test_iou.py | 3 +++ tests/modules/iou/test_iou_manager.py | 6 +++++- tests/modules/iou/test_iou_vm.py | 12 +++++++++--- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 091b5fc9..d70fa7d2 100644 --- a/README.rst +++ b/README.rst @@ -93,6 +93,9 @@ Windows Please use our all-in-one installer. +If you install it via source you need to install also: +https://sourceforge.net/projects/pywin32/ + Mac OS X -------- diff --git a/gns3server/modules/__init__.py b/gns3server/modules/__init__.py index 6a2953ae..928bb1a9 100644 --- a/gns3server/modules/__init__.py +++ b/gns3server/modules/__init__.py @@ -25,6 +25,8 @@ from .qemu import Qemu MODULES = [VPCS, VirtualBox, Dynamips, Qemu] if sys.platform.startswith("linux") or hasattr(sys, "_called_from_test") or os.environ.get("PYTEST_BUILD_DOCUMENTATION") == "1": - # IOU runs only on Linux - from .iou import IOU - MODULES.append(IOU) + + # IOU runs only on Linux but testsuite work on UNIX platform + if not sys.platform.startswith("win"): + from .iou import IOU + MODULES.append(IOU) diff --git a/tests/handlers/api/test_iou.py b/tests/handlers/api/test_iou.py index bc0f8da9..643ebc34 100644 --- a/tests/handlers/api/test_iou.py +++ b/tests/handlers/api/test_iou.py @@ -18,10 +18,13 @@ import pytest import os import stat +import sys from tests.utils import asyncio_patch from unittest.mock import patch, MagicMock, PropertyMock +pytestmark = pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") + @pytest.fixture def fake_iou_bin(tmpdir): diff --git a/tests/modules/iou/test_iou_manager.py b/tests/modules/iou/test_iou_manager.py index 84b3b7e2..7d40fdf1 100644 --- a/tests/modules/iou/test_iou_manager.py +++ b/tests/modules/iou/test_iou_manager.py @@ -20,9 +20,13 @@ import pytest from unittest.mock import patch import uuid import os +import sys +pytestmark = pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") + +if not sys.platform.startswith("win"): + from gns3server.modules.iou import IOU -from gns3server.modules.iou import IOU from gns3server.modules.iou.iou_error import IOUError from gns3server.modules.project_manager import ProjectManager diff --git a/tests/modules/iou/test_iou_vm.py b/tests/modules/iou/test_iou_vm.py index c66cfb99..398c2215 100644 --- a/tests/modules/iou/test_iou_vm.py +++ b/tests/modules/iou/test_iou_vm.py @@ -21,13 +21,19 @@ import asyncio import os import stat import socket +import sys from tests.utils import asyncio_patch from unittest.mock import patch, MagicMock, PropertyMock -from gns3server.modules.iou.iou_vm import IOUVM -from gns3server.modules.iou.iou_error import IOUError -from gns3server.modules.iou import IOU + +pytestmark = pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") + +if not sys.platform.startswith("win"): + from gns3server.modules.iou.iou_vm import IOUVM + from gns3server.modules.iou.iou_error import IOUError + from gns3server.modules.iou import IOU + from gns3server.config import Config