mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Upgrade dev dependencies and fix tests to support pytest-asyncio strict mode
This commit is contained in:
1 parent
2e91eac1eb
commit
86c44cd6e7
39 files changed
+100
-101
No files matched your search
@@ -17,6 +17,7 @@
|
||||
|
||||
import uuid
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from unittest.mock import MagicMock, patch, call
|
||||
|
||||
from gns3server.compute.builtin.nodes.cloud import Cloud
|
||||
@@ -30,8 +31,7 @@ def nio():
|
||||
return NIOUDP(4242, "127.0.0.1", 4343)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture
|
||||
async def manager():
|
||||
|
||||
m = MagicMock()
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
@@ -23,8 +24,7 @@ from gns3server.compute.docker import Docker, DOCKER_PREFERRED_API_VERSION, DOCK
|
||||
from gns3server.compute.docker.docker_error import DockerError, DockerHttp404Error
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture
|
||||
async def vm():
|
||||
|
||||
vm = Docker()
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
import aiohttp
|
||||
import asyncio
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import uuid
|
||||
import sys
|
||||
import os
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
|
||||
@@ -33,8 +33,7 @@ from gns3server.utils.get_resource import get_resource
|
||||
from unittest.mock import patch, MagicMock, call
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = Docker.instance()
|
||||
@@ -42,8 +41,7 @@ async def manager(port_manager):
|
||||
return m
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def vm(compute_project, manager):
|
||||
|
||||
vm = DockerVM("test", str(uuid.uuid4()), compute_project, manager, "ubuntu:latest", aux_type="none")
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import tempfile
|
||||
import sys
|
||||
import uuid
|
||||
import os
|
||||
|
||||
@@ -28,8 +28,7 @@ from unittest.mock import patch
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = Dynamips.instance()
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import os
|
||||
import uuid
|
||||
import pytest
|
||||
import asyncio
|
||||
import pytest_asyncio
|
||||
|
||||
from gns3server.compute.dynamips.nodes.router import Router
|
||||
from gns3server.compute.dynamips.dynamips_error import DynamipsError
|
||||
@@ -26,8 +26,7 @@ from gns3server.compute.dynamips import Dynamips
|
||||
from gns3server.config import Config
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = Dynamips.instance()
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import asyncio
|
||||
import os
|
||||
import stat
|
||||
import socket
|
||||
import sys
|
||||
import uuid
|
||||
import shutil
|
||||
|
||||
@@ -32,8 +32,7 @@ from gns3server.compute.iou.iou_error import IOUError
|
||||
from gns3server.compute.iou import IOU
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = IOU.instance()
|
||||
@@ -41,8 +40,7 @@ async def manager(port_manager):
|
||||
return m
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def vm(compute_project, manager, config, tmpdir, fake_iou_bin, iourc_file):
|
||||
|
||||
vm = IOUVM("test", str(uuid.uuid4()), compute_project, manager, application_id=1)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import asyncio
|
||||
import os
|
||||
import stat
|
||||
@@ -32,8 +33,7 @@ from gns3server.utils import force_unix_path, macaddress_to_int, int_to_macaddre
|
||||
from gns3server.compute.notification_manager import NotificationManager
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = Qemu.instance()
|
||||
@@ -63,8 +63,7 @@ def fake_qemu_binary(monkeypatch, tmpdir):
|
||||
return bin_path
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def vm(compute_project, manager, fake_qemu_binary, fake_qemu_img_binary):
|
||||
|
||||
manager.port_manager.console_host = "127.0.0.1"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
from collections import OrderedDict
|
||||
|
||||
import pytest
|
||||
import asyncio
|
||||
import pytest_asyncio
|
||||
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
|
||||
@@ -29,8 +29,7 @@ from gns3server.compute.vpcs import VPCS
|
||||
from gns3server.compute.nios.nio_udp import NIOUDP
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VPCS.instance()
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
import uuid
|
||||
import os
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from unittest.mock import patch, MagicMock
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
@@ -28,8 +29,7 @@ from gns3server.compute.error import NodeError, ImageMissingError
|
||||
from gns3server.utils import force_unix_path
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def vpcs(port_manager):
|
||||
|
||||
VPCS._instance = None
|
||||
@@ -38,8 +38,7 @@ async def vpcs(port_manager):
|
||||
return vpcs
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def qemu(port_manager):
|
||||
|
||||
Qemu._instance = None
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
import os
|
||||
import uuid
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from uuid import uuid4
|
||||
from unittest.mock import patch
|
||||
|
||||
@@ -29,8 +30,7 @@ from gns3server.compute.compute_error import ComputeError, ComputeForbiddenError
|
||||
from gns3server.compute.vpcs import VPCS, VPCSVM
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VPCS.instance()
|
||||
@@ -38,8 +38,7 @@ async def manager(port_manager):
|
||||
return m
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def node(compute_project, manager):
|
||||
|
||||
node = manager.create_node("test", compute_project.id, "00010203-0405-0607-0809-0a0b0c0d0e0f")
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import tempfile
|
||||
import os
|
||||
import stat
|
||||
@@ -28,7 +29,7 @@ from gns3server.compute.virtualbox.virtualbox_error import VirtualBoxError
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VirtualBox.instance()
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
import os
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
|
||||
from gns3server.compute.virtualbox.virtualbox_vm import VirtualBoxVM
|
||||
@@ -24,8 +25,7 @@ from gns3server.compute.virtualbox.virtualbox_error import VirtualBoxError
|
||||
from gns3server.compute.virtualbox import VirtualBox
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VirtualBox.instance()
|
||||
@@ -33,8 +33,7 @@ async def manager(port_manager):
|
||||
return m
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def vm(compute_project, manager):
|
||||
|
||||
return VirtualBoxVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", compute_project, manager, "test", False)
|
||||
|
||||
@@ -16,13 +16,12 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from gns3server.compute.vmware import VMware
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VMware.instance()
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from gns3server.compute.vmware.vmware_vm import VMwareVM
|
||||
from gns3server.compute.vmware import VMware
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VMware.instance()
|
||||
@@ -30,8 +30,7 @@ async def manager(port_manager):
|
||||
return m
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def vm(compute_project, manager, tmpdir):
|
||||
|
||||
fake_vmx = str(tmpdir / "test.vmx")
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
from gns3server.utils import parse_version
|
||||
@@ -30,8 +30,7 @@ from gns3server.compute.vpcs import VPCS
|
||||
from gns3server.compute.notification_manager import NotificationManager
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VPCS.instance()
|
||||
@@ -39,8 +38,7 @@ async def manager(port_manager):
|
||||
return m
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@pytest.mark.asyncio
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def vm(compute_project, manager, tmpdir, ubridge_path):
|
||||
|
||||
vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", compute_project, manager)
|
||||
|
||||
Reference in new issue
Block a user