Upgrade dev dependencies and fix issues after upgrading to pytest-aiohttp v1.0.4

This commit is contained in:
grossmj committed 2022-08-27 19:16:02 +02:00
1 parent 9e5ca50302
commit d1c8f33fc5
40 files changed
+108 -89

No files matched your search

@@ -55,7 +55,7 @@ async def test_start(gns3vm, controller):
assert gns3vm.password == "world"
async def test_start_invalid_vm(loop, gns3vm, controller):
async def test_start_invalid_vm(gns3vm, controller):
await controller.add_compute("r1",
name="R1",
@@ -15,8 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import pytest
import asyncio
import pytest_asyncio
from tests.utils import asyncio_patch, AsyncioMagicMock
from gns3server.utils.asyncio import wait_run_in_executor
@@ -25,8 +24,8 @@ from unittest.mock import patch
from gns3server.controller.gns3vm.virtualbox_gns3_vm import VirtualBoxGNS3VM
@pytest.fixture
async def gns3vm(loop, controller):
@pytest_asyncio.fixture
async def gns3vm(controller):
vm = VirtualBoxGNS3VM(controller)
vm.vmname = "GNS3 VM"
@@ -16,12 +16,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import pytest
import pytest_asyncio
from gns3server.controller.gns3vm.vmware_gns3_vm import VMwareGNS3VM
@pytest.fixture
async def gns3vm(loop, controller):
@pytest_asyncio.fixture
async def gns3vm(controller):
vm = VMwareGNS3VM(controller)
vm.vmname = "GNS3 VM"
+4 -3
View File
@@ -19,6 +19,7 @@
import os
import json
import pytest
import pytest_asyncio
import aiohttp
import zipfile
@@ -32,15 +33,15 @@ from gns3server.controller.export_project import export_project, _is_exportable
from gns3server.utils.asyncio import aiozipstream
@pytest.fixture
async def project(loop, controller):
@pytest_asyncio.fixture
async def project(controller):
p = Project(controller=controller, name="test")
p.dump = MagicMock()
return p
@pytest.fixture
@pytest_asyncio.fixture
async def node(controller, project):
compute = MagicMock()
+3 -3
View File
@@ -47,7 +47,7 @@ def dummy_gns3vm(controller, dummy_engine):
return vm
async def test_list(loop, controller):
async def test_list(controller):
vm = GNS3VM(controller)
with asyncio_patch("gns3server.controller.gns3vm.vmware_gns3_vm.VMwareGNS3VM.list", return_value=[{"vmname": "test", "vmx_path": "test"}]):
@@ -60,14 +60,14 @@ async def test_list(loop, controller):
await vm.list("hyperv")
async def test_json(loop, controller):
async def test_json(controller):
vm = GNS3VM(controller)
assert vm.__json__() == vm._settings
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not working well on Windows")
async def test_update_settings(loop, controller):
async def test_update_settings(controller):
vm = GNS3VM(controller)
vm.settings = {
+6 -6
View File
@@ -166,7 +166,7 @@ async def test_import_with_images(tmpdir, controller):
assert os.path.exists(path), path
async def test_import_iou_linux_no_vm(loop, linux_platform, tmpdir, controller):
async def test_import_iou_linux_no_vm(linux_platform, tmpdir, controller):
"""
On non linux host IOU should be local if we don't have a GNS3 VM
"""
@@ -210,7 +210,7 @@ async def test_import_iou_linux_no_vm(loop, linux_platform, tmpdir, controller):
assert topo["topology"]["nodes"][0]["compute_id"] == "local"
async def test_import_iou_linux_with_vm(loop, linux_platform, tmpdir, controller):
async def test_import_iou_linux_with_vm(linux_platform, tmpdir, controller):
"""
On non linux host IOU should be vm if we have a GNS3 VM configured
"""
@@ -255,7 +255,7 @@ async def test_import_iou_linux_with_vm(loop, linux_platform, tmpdir, controller
assert topo["topology"]["nodes"][0]["compute_id"] == "vm"
async def test_import_nat_non_linux(loop, windows_platform, tmpdir, controller):
async def test_import_nat_non_linux(windows_platform, tmpdir, controller):
"""
On non linux host NAT should be moved to the GNS3 VM
"""
@@ -300,7 +300,7 @@ async def test_import_nat_non_linux(loop, windows_platform, tmpdir, controller):
assert topo["topology"]["nodes"][0]["compute_id"] == "vm"
async def test_import_iou_non_linux(loop, windows_platform, tmpdir, controller):
async def test_import_iou_non_linux(windows_platform, tmpdir, controller):
"""
On non linux host IOU should be moved to the GNS3 VM
"""
@@ -356,7 +356,7 @@ async def test_import_iou_non_linux(loop, windows_platform, tmpdir, controller):
mock.assert_called_with(controller._computes["vm"], project_id, project.path, os.path.join('project-files', 'iou', topo["topology"]["nodes"][0]['node_id']))
async def test_import_node_id(loop, linux_platform, tmpdir, controller):
async def test_import_node_id(linux_platform, tmpdir, controller):
"""
When importing a node, node_id should change
"""
@@ -449,7 +449,7 @@ async def test_import_node_id(loop, linux_platform, tmpdir, controller):
assert os.path.exists(os.path.join(project.path, "project-files", "iou", topo["topology"]["nodes"][0]["node_id"], "startup.cfg"))
async def test_import_keep_compute_id(loop, windows_platform, tmpdir, controller):
async def test_import_keep_compute_id(windows_platform, tmpdir, controller):
"""
On linux host IOU should be moved to the GNS3 VM
"""
+2 -1
View File
@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import pytest
import pytest_asyncio
import aiohttp
from unittest.mock import MagicMock
@@ -26,7 +27,7 @@ from gns3server.controller.ports.serial_port import SerialPort
from tests.utils import AsyncioBytesIO, AsyncioMagicMock
@pytest.fixture
@pytest_asyncio.fixture
async def link(project, compute):
node1 = Node(project, compute, "node1", node_type="qemu")
+2 -2
View File
@@ -15,13 +15,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import pytest
import pytest_asyncio
from unittest.mock import MagicMock
from tests.utils import AsyncioMagicMock
@pytest.fixture
@pytest_asyncio.fixture
async def node(project):
compute = MagicMock()
+2 -1
View File
@@ -20,6 +20,7 @@ import os
import sys
import uuid
import pytest
import pytest_asyncio
import aiohttp
from unittest.mock import MagicMock
from tests.utils import AsyncioMagicMock, asyncio_patch
@@ -33,7 +34,7 @@ from gns3server.controller.ports.ethernet_port import EthernetPort
from gns3server.config import Config
@pytest.fixture
@pytest_asyncio.fixture
async def node(controller, project):
compute = MagicMock()