diff --git a/pkgs/clan-cli/tests/helpers/cli.py b/pkgs/clan-cli/tests/helpers/cli.py index dbfb066a4..46e4989f1 100644 --- a/pkgs/clan-cli/tests/helpers/cli.py +++ b/pkgs/clan-cli/tests/helpers/cli.py @@ -6,6 +6,16 @@ import sys import shlex log = logging.getLogger(__name__) +import inspect + +def get_caller() -> str: + frame = inspect.currentframe() + caller_frame = frame.f_back.f_back + frame_info = inspect.getframeinfo(caller_frame) + ret = f"{frame_info.filename}:{frame_info.lineno}::{frame_info.function}" + return ret + + class Cli: def __init__(self) -> None: self.parser = create_parser(prog="clan") @@ -13,6 +23,7 @@ class Cli: def run(self, args: list[str]) -> argparse.Namespace: cmd = shlex.join(["clan"] + args) log.debug(f"Command: {cmd}") + log.debug(f"Caller {get_caller()}") parsed = self.parser.parse_args(args) if hasattr(parsed, "func"): parsed.func(parsed) diff --git a/pkgs/clan-cli/tests/test_secrets_cli.py b/pkgs/clan-cli/tests/test_secrets_cli.py index f18a3d099..d68b91a1a 100644 --- a/pkgs/clan-cli/tests/test_secrets_cli.py +++ b/pkgs/clan-cli/tests/test_secrets_cli.py @@ -25,7 +25,7 @@ def _test_identities( cli = Cli() sops_folder = test_flake.path / "sops" - cli.run(["secrets", what, "add", "foo", age_keys[0].pubkey]) + cli.run(["secrets", what, "add", "foo", age_keys[0].pubkey, test_flake.name]) assert (sops_folder / what / "foo" / "key.json").exists() with pytest.raises(ClanError): cli.run(["secrets", what, "add", "foo", age_keys[0].pubkey])