Skip to content

Suite

suite

canonical_suite_name(project_root)

Return the namespaced test-suite directory for a project directory.

Source code in packages/axm-ingot/src/axm_ingot/suite.py
Python
def canonical_suite_name(project_root: str | Path) -> str:
    """Return the namespaced test-suite directory for a project directory."""
    project_name = Path(project_root).name
    normalized = _PROJECT_SEPARATOR.sub("_", project_name)
    return f"tests_{normalized}"

is_suite_name(name)

Return whether name denotes a legacy or namespaced suite root.

Source code in packages/axm-ingot/src/axm_ingot/suite.py
Python
def is_suite_name(name: str) -> bool:
    """Return whether *name* denotes a legacy or namespaced suite root."""
    return name == "tests" or (name.startswith("tests_") and len(name) > len("tests_"))

is_suite_path(path)

Return whether any component of path is a recognized suite root.

Source code in packages/axm-ingot/src/axm_ingot/suite.py
Python
def is_suite_path(path: str | Path) -> bool:
    """Return whether any component of *path* is a recognized suite root."""
    return any(is_suite_name(part) for part in Path(path).parts)

resolve_suite_dir(project_root)

Resolve a project's primary suite root from config, then convention.

Source code in packages/axm-ingot/src/axm_ingot/suite.py
Python
def resolve_suite_dir(project_root: str | Path) -> Path | None:
    """Resolve a project's primary suite root from config, then convention."""
    root = Path(project_root)
    suites = _direct_suite_dirs(root)
    return suites[0] if suites else None

resolve_suite_dirs(project_root)

Resolve suite roots owned by a project and each uv-workspace member.

Source code in packages/axm-ingot/src/axm_ingot/suite.py
Python
def resolve_suite_dirs(project_root: str | Path) -> tuple[Path, ...]:
    """Resolve suite roots owned by a project and each uv-workspace member."""
    from axm_ingot.uv import resolve_workspace

    root = Path(project_root)
    suites: list[Path] = []
    suites.extend(_direct_suite_dirs(root))

    workspace = resolve_workspace(root)
    if workspace is None:
        return tuple(suites)

    for member in workspace.members:
        for suite in _direct_suite_dirs(member.path):
            if suite not in suites:
                suites.append(suite)
    return tuple(suites)