Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ matrix = ["mautrix[encryption]==0.21.0", "aiosqlite==0.22.1", "asyncpg==0.31.0",
# and XXE. aiohttp/httpx are already in [messaging]; defusedxml lands
# here to keep the dependency local to wecom_callback's threat model.
wecom = ["defusedxml==0.7.1"]
cli = ["simple-term-menu==1.6.6"]
cli = ["simple-term-menu==1.6.6", "tiktoken==0.12.0"]
tts-premium = ["elevenlabs==1.59.0"]
voice = [
# Local STT pulls in wheel-only transitive deps (ctranslate2, onnxruntime),
Expand Down
22 changes: 21 additions & 1 deletion tests/hermes_cli/test_tool_token_estimation.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
"""Tests for tool token estimation and curses_ui status_fn support."""

import tomllib
from pathlib import Path

import pytest
from packaging.requirements import Requirement
from packaging.utils import canonicalize_name

# tiktoken is not in core/[all] deps — skip estimation tests when unavailable
# tiktoken is supplied by the CLI extra; keep runtime fallback tests for base installs.
_has_tiktoken = True
try:
import tiktoken # noqa: F401
Expand All @@ -13,6 +17,22 @@
_needs_tiktoken = pytest.mark.skipif(not _has_tiktoken, reason="tiktoken not installed")


# ─── Packaging Metadata Tests ────────────────────────────────────────────────


def test_cli_extra_declares_tiktoken_dependency():
"""CLI installs should include tiktoken for tool token estimates."""
project_root = Path(__file__).resolve().parents[2]
pyproject = tomllib.loads((project_root / "pyproject.toml").read_text())

cli_extra = pyproject["project"]["optional-dependencies"]["cli"]

assert any(
canonicalize_name(Requirement(requirement).name) == "tiktoken"
for requirement in cli_extra
)


# ─── Token Estimation Tests ──────────────────────────────────────────────────


Expand Down
Loading
Loading