mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Upgrade dev dependencies and fix issues after upgrading to pytest-aiohttp v1.0.4
This commit is contained in:
1 parent
9e5ca50302
commit
d1c8f33fc5
40 files changed
+108
-89
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,8 @@ def nio():
|
||||
return NIOUDP(4242, "127.0.0.1", 4343)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def manager(loop):
|
||||
@pytest_asyncio.fixture
|
||||
async def manager():
|
||||
|
||||
m = MagicMock()
|
||||
m.module_name = "builtins"
|
||||
@@ -113,7 +114,7 @@ def test_json_without_ports(on_gns3vm, compute_project, manager):
|
||||
}
|
||||
|
||||
|
||||
async def test_update_port_mappings(loop, on_gns3vm, compute_project):
|
||||
async def test_update_port_mappings(on_gns3vm, compute_project):
|
||||
"""
|
||||
We don't allow an empty interface in the middle of port list
|
||||
"""
|
||||
@@ -153,7 +154,7 @@ async def test_update_port_mappings(loop, on_gns3vm, compute_project):
|
||||
assert cloud.ports_mapping == ports1
|
||||
|
||||
|
||||
async def test_linux_ethernet_raw_add_nio(loop, linux_platform, compute_project, nio):
|
||||
async def test_linux_ethernet_raw_add_nio(linux_platform, compute_project, nio):
|
||||
ports = [
|
||||
{
|
||||
"interface": "eth0",
|
||||
@@ -180,7 +181,7 @@ async def test_linux_ethernet_raw_add_nio(loop, linux_platform, compute_project,
|
||||
])
|
||||
|
||||
|
||||
async def test_linux_ethernet_raw_add_nio_bridge(loop, linux_platform, compute_project, nio):
|
||||
async def test_linux_ethernet_raw_add_nio_bridge(linux_platform, compute_project, nio):
|
||||
"""
|
||||
Bridge can't be connected directly to a cloud we use a tap in the middle
|
||||
"""
|
||||
|
||||
@@ -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,8 @@ from gns3server.compute.docker import Docker, DOCKER_PREFERRED_API_VERSION, DOCK
|
||||
from gns3server.compute.docker.docker_error import DockerError, DockerHttp404Error
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def vm(loop):
|
||||
@pytest_asyncio.fixture
|
||||
async def vm():
|
||||
|
||||
vm = Docker()
|
||||
vm._connected = True
|
||||
|
||||
@@ -34,7 +34,7 @@ from unittest.mock import patch, MagicMock, call
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
async def manager(loop, port_manager):
|
||||
async def manager(port_manager):
|
||||
|
||||
m = Docker.instance()
|
||||
m.port_manager = port_manager
|
||||
@@ -42,7 +42,7 @@ async def manager(loop, port_manager):
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
async def vm(loop, compute_project, manager):
|
||||
async def vm(compute_project, manager):
|
||||
|
||||
vm = DockerVM("test", str(uuid.uuid4()), compute_project, manager, "ubuntu:latest")
|
||||
vm._cid = "e90e34656842"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import tempfile
|
||||
import sys
|
||||
import uuid
|
||||
@@ -28,8 +29,8 @@ from unittest.mock import patch
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def manager(loop, port_manager):
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = Dynamips.instance()
|
||||
m.port_manager = port_manager
|
||||
|
||||
@@ -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,8 @@ from gns3server.compute.dynamips import Dynamips
|
||||
from gns3server.config import Config
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def manager(loop, port_manager):
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = Dynamips.instance()
|
||||
m.port_manager = port_manager
|
||||
|
||||
@@ -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
|
||||
@@ -36,8 +37,8 @@ if not sys.platform.startswith("win"):
|
||||
from gns3server.compute.iou import IOU
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def manager(loop, port_manager):
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = IOU.instance()
|
||||
m.port_manager = port_manager
|
||||
@@ -45,7 +46,7 @@ async def manager(loop, port_manager):
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
async def vm(loop, compute_project, manager, tmpdir, fake_iou_bin, iourc_file):
|
||||
async def vm(compute_project, manager, tmpdir, fake_iou_bin, iourc_file):
|
||||
|
||||
vm = IOUVM("test", str(uuid.uuid4()), compute_project, manager, application_id=1)
|
||||
config = manager.config.get_section_config("IOU")
|
||||
|
||||
@@ -66,7 +66,7 @@ def test_invalid_empty_file(tmpdir):
|
||||
|
||||
|
||||
@pytest.mark.skipif(qemu_img() is None, reason="qemu-img is not available")
|
||||
async def test_rebase(loop, tmpdir):
|
||||
async def test_rebase(tmpdir):
|
||||
|
||||
shutil.copy("tests/resources/empty8G.qcow2", str(tmpdir / "empty16G.qcow2"))
|
||||
shutil.copy("tests/resources/linked.qcow2", str(tmpdir / "linked.qcow2"))
|
||||
|
||||
@@ -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 sys
|
||||
@@ -33,8 +34,8 @@ from gns3server.utils import force_unix_path, macaddress_to_int, int_to_macaddre
|
||||
from gns3server.compute.notification_manager import NotificationManager
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def manager(loop, port_manager):
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = Qemu.instance()
|
||||
m.port_manager = port_manager
|
||||
|
||||
@@ -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,8 @@ from gns3server.compute.vpcs import VPCS
|
||||
from gns3server.compute.nios.nio_udp import NIOUDP
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
async def manager(loop, port_manager):
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VPCS.instance()
|
||||
m.port_manager = port_manager
|
||||
|
||||
@@ -29,7 +29,7 @@ from gns3server.utils import force_unix_path
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
async def vpcs(loop, port_manager):
|
||||
async def vpcs(port_manager):
|
||||
|
||||
VPCS._instance = None
|
||||
vpcs = VPCS.instance()
|
||||
@@ -38,7 +38,7 @@ async def vpcs(loop, port_manager):
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
async def qemu(loop, port_manager):
|
||||
async def qemu(port_manager):
|
||||
|
||||
Qemu._instance = None
|
||||
Qemu._init_config_disk = MagicMock() # do not create the config.img image
|
||||
|
||||
@@ -33,7 +33,7 @@ from gns3server.config import Config
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
async def manager(loop, port_manager):
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VPCS.instance()
|
||||
m.port_manager = port_manager
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import asyncio
|
||||
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
@@ -27,15 +28,15 @@ from gns3server.compute.traceng import TraceNG
|
||||
from gns3server.compute.notification_manager import NotificationManager
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def manager(loop, port_manager):
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = TraceNG.instance()
|
||||
m.port_manager = port_manager
|
||||
return m
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def vm(compute_project, manager, ubridge_path):
|
||||
|
||||
vm = TraceNGVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", compute_project, manager)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import tempfile
|
||||
import os
|
||||
import stat
|
||||
@@ -28,8 +29,8 @@ from gns3server.compute.virtualbox.virtualbox_error import VirtualBoxError
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def manager(loop, port_manager):
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VirtualBox.instance()
|
||||
m.port_manager = port_manager
|
||||
|
||||
@@ -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,8 @@ from gns3server.compute.virtualbox.virtualbox_error import VirtualBoxError
|
||||
from gns3server.compute.virtualbox import VirtualBox
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def manager(loop, port_manager):
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VirtualBox.instance()
|
||||
m.port_manager = port_manager
|
||||
|
||||
@@ -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 import VMware
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def manager(loop, port_manager):
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VMware.instance()
|
||||
m.port_manager = port_manager
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
import asyncio
|
||||
import pytest_asyncio
|
||||
|
||||
from gns3server.compute.vmware.vmware_vm import VMwareVM
|
||||
from gns3server.compute.vmware import VMware
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def manager(loop, port_manager):
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VMware.instance()
|
||||
m.port_manager = port_manager
|
||||
|
||||
@@ -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 sys
|
||||
@@ -30,8 +31,8 @@ from gns3server.compute.vpcs import VPCS
|
||||
from gns3server.compute.notification_manager import NotificationManager
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def manager(loop, port_manager):
|
||||
@pytest_asyncio.fixture
|
||||
async def manager(port_manager):
|
||||
|
||||
m = VPCS.instance()
|
||||
m.port_manager = port_manager
|
||||
@@ -39,7 +40,7 @@ async def manager(loop, port_manager):
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
async def vm(loop, compute_project, manager, tmpdir, ubridge_path):
|
||||
async def vm(compute_project, manager, tmpdir, ubridge_path):
|
||||
|
||||
vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", compute_project, manager)
|
||||
vm._vpcs_version = parse_version("0.9")
|
||||
|
||||
Reference in new issue
Block a user