Added more deal tests

This commit is contained in:
Qubasa
2023-11-21 16:44:38 +01:00
parent c39eb24318
commit 17c71d2f40
5 changed files with 47 additions and 12 deletions

View File

@@ -1,8 +1,9 @@
import asyncio
import logging
import deal
import shlex
from pathlib import Path
from typing import Any, Callable, Coroutine, Dict, NamedTuple, Optional
from typing import Any, Callable, Coroutine, Dict, NamedTuple, Optional, Awaitable
from .custom_logger import get_caller
from .errors import ClanError
@@ -15,8 +16,8 @@ class CmdOut(NamedTuple):
stderr: str
cwd: Optional[Path] = None
async def run(cmd: list[str], cwd: Optional[Path] = None) -> CmdOut:
@deal.raises(ClanError)
async def run(cmd: list[str], cwd: Optional[Path] = None) -> Awaitable[CmdOut]:
cwd_res = None
if cwd is not None:
if not cwd.exists():
@@ -51,6 +52,7 @@ stdout:
return CmdOut(stdout.decode("utf-8"), stderr.decode("utf-8"), cwd=cwd)
@deal.raises(ClanError)
def runforcli(
func: Callable[..., Coroutine[Any, Any, Dict[str, CmdOut]]], *args: Any
) -> None: