forked from cleveragents/cleveragents-core
34 lines
855 B
Python
34 lines
855 B
Python
"""Benchmarks for CleverAgents CLI entrypoints."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import contextlib
|
|
import io
|
|
import sys
|
|
from collections.abc import Sequence
|
|
from pathlib import Path
|
|
|
|
try:
|
|
from cleveragents.cli import main
|
|
except ModuleNotFoundError:
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
|
from cleveragents.cli import main
|
|
|
|
|
|
class TimeSuite:
|
|
"""Measure CLI startup behavior."""
|
|
|
|
@staticmethod
|
|
def _run(argv: Sequence[str]) -> None:
|
|
buffer = io.StringIO()
|
|
with contextlib.redirect_stdout(buffer):
|
|
main(argv)
|
|
|
|
def time_help_invocation(self) -> None:
|
|
"""Benchmark the `agents --help` path."""
|
|
self._run(["--help"])
|
|
|
|
def time_version_invocation(self) -> None:
|
|
"""Benchmark the `agents --version` path."""
|
|
self._run(["--version"])
|