diff --git a/src/relic/sga/core/cli.py b/src/relic/sga/core/cli.py index 0f1ca42..a4b7423 100644 --- a/src/relic/sga/core/cli.py +++ b/src/relic/sga/core/cli.py @@ -11,7 +11,9 @@ class RelicSgaCli(CliPluginGroup): GROUP = "relic.cli.sga" - def _create_parser(self, command_group: Optional[_SubParsersAction] = None) -> ArgumentParser: + def _create_parser( + self, command_group: Optional[_SubParsersAction] = None + ) -> ArgumentParser: if command_group is None: return ArgumentParser("sga") else: @@ -19,8 +21,9 @@ def _create_parser(self, command_group: Optional[_SubParsersAction] = None) -> A class RelicSgaUnpackCli(CliPlugin): - - def _create_parser(self, command_group: Optional[_SubParsersAction] = None) -> ArgumentParser: + def _create_parser( + self, command_group: Optional[_SubParsersAction] = None + ) -> ArgumentParser: parser: ArgumentParser if command_group is None: parser = ArgumentParser("unpack") @@ -38,7 +41,7 @@ def command(self, ns: Namespace) -> Optional[int]: print(f"Unpacking `{infile}`") - def _callback(_1: FS, srcfile: str, _2: FS, _3: str): + def _callback(_1: FS, srcfile: str, _2: FS, _3: str) -> None: print(f"\t\tUnpacking File `{srcfile}`") fs.copy.copy_fs(f"sga://{infile}", f"osfs://{outdir}", on_copy=_callback) @@ -49,7 +52,9 @@ def _callback(_1: FS, srcfile: str, _2: FS, _3: str): class RelicSgaPackCli(CliPluginGroup): GROUP = "relic.cli.sga.pack" - def _create_parser(self, command_group: Optional[_SubParsersAction] = None) -> ArgumentParser: + def _create_parser( + self, command_group: Optional[_SubParsersAction] = None + ) -> ArgumentParser: parser: ArgumentParser if command_group is None: parser = ArgumentParser("pack") @@ -59,4 +64,3 @@ def _create_parser(self, command_group: Optional[_SubParsersAction] = None) -> A # pack further delegates to version plugins return parser - diff --git a/tests/test_cli.py b/tests/test_cli.py index 7c2305b..5bce432 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,5 +1,6 @@ import io import subprocess + # Local testing requires running `pip install -e "."` from contextlib import redirect_stdout from typing import Sequence @@ -19,6 +20,7 @@ def test_run(self, args: Sequence[str], output: str, exit_code: int): def test_run_with(self, args: Sequence[str], output: str, exit_code: int): from relic.core.cli import cli_root + with io.StringIO() as f: with redirect_stdout(f): status = cli_root.run_with(*args) @@ -34,7 +36,7 @@ def test_run_with(self, args: Sequence[str], output: str, exit_code: int): _SGA_UNPACK_HELP = ["sga", "unpack", "-h"], """usage: relic sga unpack [-h]""", 0 _TESTS = [_SGA_HELP, _SGA_PACK_HELP, _SGA_UNPACK_HELP] -_TEST_IDS = [' '.join(_[0]) for _ in _TESTS] +_TEST_IDS = [" ".join(_[0]) for _ in _TESTS] @pytest.mark.parametrize(["args", "output", "exit_code"], _TESTS, ids=_TEST_IDS)