From 9ac34be48f75899a0bea5e55f218aab274a65f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 29 Nov 2023 08:16:00 +0100 Subject: [PATCH] test: use builtins for type annotations instead of List / Optional --- tests/procs.py | 10 +++++----- tests/test_use_nix.py | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/procs.py b/tests/procs.py index ea837d4..668b64f 100644 --- a/tests/procs.py +++ b/tests/procs.py @@ -1,19 +1,19 @@ import subprocess from pathlib import Path -from typing import IO, Any, List, Optional, Union +from typing import IO, Any -_FILE = Union[None, int, IO[Any]] -_DIR = Union[None, Path, str] +_FILE = None | int | IO[Any] +_DIR = None | Path | str def run( - cmd: List[str], + cmd: list[str], text: bool = True, check: bool = True, cwd: _DIR = None, stderr: _FILE = None, stdout: _FILE = None, - env: Optional[dict[str, str]] = None, + env: dict[str, str] | None = None, ) -> subprocess.CompletedProcess: if cwd is not None: print(f"cd {cwd}") diff --git a/tests/test_use_nix.py b/tests/test_use_nix.py index 6242490..af7da4e 100644 --- a/tests/test_use_nix.py +++ b/tests/test_use_nix.py @@ -2,7 +2,6 @@ import os import subprocess import sys import unittest -from typing import Optional import pytest @@ -11,7 +10,7 @@ from .procs import run def direnv_exec( - direnv_project: DirenvProject, cmd: str, env: Optional[dict[str, str]] = None + direnv_project: DirenvProject, cmd: str, env: dict[str, str] | None = None ) -> None: args = ["direnv", "exec", str(direnv_project.directory), "sh", "-c", cmd] print("$ " + " ".join(args))