Upgrade dev dependencies and fix tests to support pytest-asyncio strict mode

This commit is contained in:
grossmj committed 2022-08-24 21:03:16 +02:00
1 parent 2e91eac1eb
commit 86c44cd6e7
39 files changed
+100 -101

No files matched your search

+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
from fastapi import FastAPI, status
from httpx import AsyncClient
@@ -171,7 +172,7 @@ class TestGroupMembersRoutes:
assert len(members) == 0
@pytest.fixture
@pytest_asyncio.fixture
async def test_role(db_session: AsyncSession) -> Role:
new_role = schemas.RoleCreate(
+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
from typing import Tuple
from fastapi import FastAPI, status
@@ -34,7 +35,7 @@ from gns3server.controller.udp_link import UDPLink
pytestmark = pytest.mark.asyncio
@pytest.fixture
@pytest_asyncio.fixture
async def nodes(compute: Compute, project: Project) -> Tuple[Node, Node]:
response = MagicMock()
@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import pytest
import pytest_asyncio
import uuid
from fastapi import FastAPI, status
@@ -31,7 +32,7 @@ pytestmark = pytest.mark.asyncio
class TestPermissionRoutes:
@pytest.fixture()
@pytest_asyncio.fixture
async def project(self, app: FastAPI, client: AsyncClient, controller: Controller) -> Project:
project_uuid = str(uuid.uuid4())
+2 -1
View File
@@ -19,6 +19,7 @@ import uuid
import os
import json
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from httpx import AsyncClient
@@ -32,7 +33,7 @@ from gns3server.controller.project import Project
pytestmark = pytest.mark.asyncio
@pytest.fixture
@pytest_asyncio.fixture
async def project(app: FastAPI, client: AsyncClient, controller: Controller) -> Project:
u = str(uuid.uuid4())
+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
from fastapi import FastAPI, status
from httpx import AsyncClient
@@ -105,7 +106,7 @@ class TestRolesRoutes:
assert response.status_code == status.HTTP_403_FORBIDDEN
@pytest.fixture
@pytest_asyncio.fixture
async def test_permission(db_session: AsyncSession) -> Permission:
new_permission = schemas.PermissionCreate(
@@ -18,6 +18,7 @@
import os
import uuid
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from httpx import AsyncClient
@@ -29,7 +30,7 @@ from gns3server.controller.snapshot import Snapshot
pytestmark = pytest.mark.asyncio
@pytest.fixture
@pytest_asyncio.fixture
async def project(app: FastAPI, client: AsyncClient, controller: Controller) -> Project:
u = str(uuid.uuid4())
@@ -39,7 +40,7 @@ async def project(app: FastAPI, client: AsyncClient, controller: Controller) ->
return project
@pytest.fixture
@pytest_asyncio.fixture
async def snapshot(project: Project):
snapshot = await project.snapshot("test")
+3 -1
View File
@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import pytest
import pytest_asyncio
from typing import Optional
from fastapi import FastAPI, HTTPException, status
@@ -438,7 +439,8 @@ class TestSuperAdmin:
# assert response.status_code == status.HTTP_200_OK
# assert len(response.json()) == 1
@pytest.fixture
@pytest_asyncio.fixture
async def test_permission(db_session: AsyncSession) -> Permission:
new_permission = schemas.PermissionCreate(