Skip to content

_utils

Full name: tenets.cli.commands._utils

_utils

Shared helpers for CLI command modules.

Functions

normalize_path

Python
normalize_path(p: Union[str, Path]) -> str

Return a normalized absolute path string for stable testing/logging.

Ensures platform-appropriate formatting and avoids returning Path objects so that tests can compare against stringified call arguments consistently.

Source code in tenets/cli/commands/_utils.py
Python
def normalize_path(p: Union[str, Path]) -> str:
    """Return a normalized absolute path string for stable testing/logging.

    Ensures platform-appropriate formatting and avoids returning Path objects
    so that tests can compare against stringified call arguments consistently.
    """
    try:
        return str(Path(p).resolve())
    except Exception:
        return str(p)