Added more deal tests
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user