summaryrefslogtreecommitdiff
path: root/testenv
diff options
context:
space:
mode:
Diffstat (limited to 'testenv')
-rw-r--r--testenv/linters/mypy.ini2
-rw-r--r--testenv/tests/apps/htpasswd/test_main.py3
-rw-r--r--testenv/tests/apps/kvmd/test_auth.py7
-rw-r--r--testenv/tests/plugins/auth/test_http.py3
-rw-r--r--testenv/tests/plugins/auth/test_pam.py8
-rw-r--r--testenv/tests/test_aiotools.py4
-rw-r--r--testenv/tests/validators/test_auth.py3
-rw-r--r--testenv/tests/validators/test_basic.py5
-rw-r--r--testenv/tests/validators/test_net.py3
-rw-r--r--testenv/tests/validators/test_os.py3
10 files changed, 14 insertions, 27 deletions
diff --git a/testenv/linters/mypy.ini b/testenv/linters/mypy.ini
index 00dd6881..33877875 100644
--- a/testenv/linters/mypy.ini
+++ b/testenv/linters/mypy.ini
@@ -1,5 +1,5 @@
[mypy]
-python_version = 3.9
+python_version = 3.10
ignore_missing_imports = true
disallow_untyped_defs = true
strict_optional = true
diff --git a/testenv/tests/apps/htpasswd/test_main.py b/testenv/tests/apps/htpasswd/test_main.py
index 670539f2..e98281e1 100644
--- a/testenv/tests/apps/htpasswd/test_main.py
+++ b/testenv/tests/apps/htpasswd/test_main.py
@@ -26,7 +26,6 @@ import tempfile
import builtins
import getpass
-from typing import List
from typing import Generator
from typing import Any
@@ -54,7 +53,7 @@ def _htpasswd_fixture(request) -> Generator[passlib.apache.HtpasswdFile, None, N
os.remove(path)
-def _run_htpasswd(cmd: List[str], htpasswd_path: str, internal_type: str="htpasswd") -> None:
+def _run_htpasswd(cmd: list[str], htpasswd_path: str, internal_type: str="htpasswd") -> None:
cmd = ["kvmd-htpasswd", *cmd, "--set-options"]
if internal_type != "htpasswd": # By default
cmd.append("kvmd/auth/internal/type=" + internal_type)
diff --git a/testenv/tests/apps/kvmd/test_auth.py b/testenv/tests/apps/kvmd/test_auth.py
index 742e7a2c..4a9b8766 100644
--- a/testenv/tests/apps/kvmd/test_auth.py
+++ b/testenv/tests/apps/kvmd/test_auth.py
@@ -23,10 +23,7 @@
import os
import contextlib
-from typing import List
-from typing import Dict
from typing import AsyncGenerator
-from typing import Optional
import passlib.apache
@@ -40,7 +37,7 @@ from kvmd.plugins.auth import get_auth_service_class
# =====
-def _make_service_kwargs(path: str) -> Dict:
+def _make_service_kwargs(path: str) -> dict:
cls = get_auth_service_class("htpasswd")
scheme = cls.get_plugin_options()
return make_config({"file": path}, scheme)._unpack()
@@ -50,7 +47,7 @@ def _make_service_kwargs(path: str) -> Dict:
async def _get_configured_manager(
internal_path: str,
external_path: str="",
- force_internal_users: Optional[List[str]]=None,
+ force_internal_users: (list[str] | None)=None,
) -> AsyncGenerator[AuthManager, None]:
manager = AuthManager(
diff --git a/testenv/tests/plugins/auth/test_http.py b/testenv/tests/plugins/auth/test_http.py
index 7a13f9b7..a02df543 100644
--- a/testenv/tests/plugins/auth/test_http.py
+++ b/testenv/tests/plugins/auth/test_http.py
@@ -20,7 +20,6 @@
# ========================================================================== #
-from typing import Dict
from typing import AsyncGenerator
import aiohttp.web
@@ -68,7 +67,7 @@ async def _auth_server_port_fixture(aiohttp_server) -> AsyncGenerator[int, None]
{"verify": False},
{"user": "server-admin", "passwd": "server-pass"},
])
-async def test_ok(auth_server_port: int, kwargs: Dict) -> None:
+async def test_ok(auth_server_port: int, kwargs: dict) -> None:
url = "http://localhost:%d/%s" % (
auth_server_port,
("auth_plus_basic" if kwargs.get("user") else "auth"),
diff --git a/testenv/tests/plugins/auth/test_pam.py b/testenv/tests/plugins/auth/test_pam.py
index ea524cb4..d165365b 100644
--- a/testenv/tests/plugins/auth/test_pam.py
+++ b/testenv/tests/plugins/auth/test_pam.py
@@ -24,9 +24,7 @@ import os
import asyncio
import pwd
-from typing import Dict
from typing import AsyncGenerator
-from typing import Optional
import pytest
import pytest_asyncio
@@ -41,7 +39,7 @@ _PASSWD = "query"
# =====
-async def _run_process(cmd: str, input: Optional[str]=None) -> None: # pylint: disable=redefined-builtin
+async def _run_process(cmd: str, input: (str | None)=None) -> None: # pylint: disable=redefined-builtin
proc = await asyncio.create_subprocess_exec(
*cmd.split(" "),
stdin=(asyncio.subprocess.PIPE if input is not None else None),
@@ -75,7 +73,7 @@ async def _test_user() -> AsyncGenerator[None, None]:
{"allow_users": [_USER]},
{"allow_uids_at": _UID},
])
-async def test_ok(test_user, kwargs: Dict) -> None: # type: ignore
+async def test_ok(test_user, kwargs: dict) -> None: # type: ignore
_ = test_user
async with get_configured_auth_service("pam", **kwargs) as service:
assert not (await service.authorize(_USER, "invalid_password"))
@@ -88,7 +86,7 @@ async def test_ok(test_user, kwargs: Dict) -> None: # type: ignore
{"deny_users": [_USER]},
{"allow_uids_at": _UID + 1},
])
-async def test_fail(test_user, kwargs: Dict) -> None: # type: ignore
+async def test_fail(test_user, kwargs: dict) -> None: # type: ignore
_ = test_user
async with get_configured_auth_service("pam", **kwargs) as service:
assert not (await service.authorize(_USER, "invalid_password"))
diff --git a/testenv/tests/test_aiotools.py b/testenv/tests/test_aiotools.py
index 9ccaee0a..1ceae318 100644
--- a/testenv/tests/test_aiotools.py
+++ b/testenv/tests/test_aiotools.py
@@ -22,8 +22,6 @@
import asyncio
-from typing import List
-
import pytest
from kvmd.aiotools import AioExclusiveRegion
@@ -123,7 +121,7 @@ async def test_fail__region__access_two() -> None:
# =====
@pytest.mark.asyncio
async def test_ok__shield_fg() -> None:
- ops: List[str] = []
+ ops: list[str] = []
async def foo(op: str, delay: float) -> None: # pylint: disable=disallowed-name
await asyncio.sleep(delay)
diff --git a/testenv/tests/validators/test_auth.py b/testenv/tests/validators/test_auth.py
index ad56bbe0..789d8ece 100644
--- a/testenv/tests/validators/test_auth.py
+++ b/testenv/tests/validators/test_auth.py
@@ -20,7 +20,6 @@
# ========================================================================== #
-from typing import List
from typing import Any
import pytest
@@ -72,7 +71,7 @@ def test_fail__valid_user(arg: Any) -> None:
(", foo, ", ["foo"]),
([], []),
])
-def test_ok__valid_users_list(arg: Any, retval: List) -> None:
+def test_ok__valid_users_list(arg: Any, retval: list) -> None:
assert valid_users_list(arg) == retval
diff --git a/testenv/tests/validators/test_basic.py b/testenv/tests/validators/test_basic.py
index c0e7b9ba..6303ed96 100644
--- a/testenv/tests/validators/test_basic.py
+++ b/testenv/tests/validators/test_basic.py
@@ -20,7 +20,6 @@
# ========================================================================== #
-from typing import List
from typing import Any
import pytest
@@ -151,7 +150,7 @@ def test_fail__valid_float_f01(arg: Any) -> None:
(", a, ", ["a"]),
([], []),
])
-def test_ok__valid_string_list(arg: Any, retval: List) -> None:
+def test_ok__valid_string_list(arg: Any, retval: list) -> None:
assert valid_string_list(arg) == retval
@@ -165,7 +164,7 @@ def test_ok__valid_string_list(arg: Any, retval: List) -> None:
(", 1, ", [1]),
([], []),
])
-def test_ok__valid_string_list__subval(arg: Any, retval: List) -> None: # pylint: disable=invalid-name
+def test_ok__valid_string_list__subval(arg: Any, retval: list) -> None: # pylint: disable=invalid-name
assert valid_string_list(arg, subval=int) == retval
diff --git a/testenv/tests/validators/test_net.py b/testenv/tests/validators/test_net.py
index 288f4799..8067322e 100644
--- a/testenv/tests/validators/test_net.py
+++ b/testenv/tests/validators/test_net.py
@@ -20,7 +20,6 @@
# ========================================================================== #
-from typing import List
from typing import Any
import pytest
@@ -168,7 +167,7 @@ def test_fail__valid_port(arg: Any) -> None:
("80,443,443,", [80, 443, 443]),
(65535, [65535]),
])
-def test_ok__valid_ports_list(arg: Any, retval: List[int]) -> None:
+def test_ok__valid_ports_list(arg: Any, retval: list[int]) -> None:
assert valid_ports_list(arg) == retval
diff --git a/testenv/tests/validators/test_os.py b/testenv/tests/validators/test_os.py
index 4cdd5aa4..cabb8e51 100644
--- a/testenv/tests/validators/test_os.py
+++ b/testenv/tests/validators/test_os.py
@@ -22,7 +22,6 @@
import os
-from typing import List
from typing import Any
import pytest
@@ -148,7 +147,7 @@ def test_fail__valid_unix_mode(arg: Any) -> None:
("/bin/true, 1, 2, 3,", ["/bin/true", "1", "2", "3"]),
("/bin/true", ["/bin/true"]),
])
-def test_ok__valid_command(arg: Any, retval: List[str]) -> None:
+def test_ok__valid_command(arg: Any, retval: list[str]) -> None:
assert valid_command(arg) == retval