Cursor Agent CLI wrapper (mycursor) with resume/session listing. Product xiaohe CLI stays in xiaohe-api only — no dual entry.
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
"""Tests for myagents.commands.version."""
|
|
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
from myagents.commands import version as ver_mod
|
|
|
|
|
|
class TestDescribeTree:
|
|
def test_development_checkout(self, tmp_path: Path) -> None:
|
|
repo = tmp_path / "repo"
|
|
repo.mkdir()
|
|
(repo / ".git").mkdir()
|
|
mode, _ = ver_mod.describe_tree(repo)
|
|
assert mode == "development"
|
|
|
|
def test_unknown_tree(self, tmp_path: Path) -> None:
|
|
mode, _ = ver_mod.describe_tree(tmp_path)
|
|
assert mode == "unknown"
|
|
|
|
|
|
class TestGitDescribe:
|
|
def test_describes_real_repo(self, tmp_path: Path) -> None:
|
|
repo = tmp_path / "repo"
|
|
repo.mkdir()
|
|
subprocess.run(["git", "init", "-q"], cwd=repo, check=True)
|
|
subprocess.run(
|
|
[
|
|
"git",
|
|
"-c",
|
|
"user.email=t@t",
|
|
"-c",
|
|
"user.name=t",
|
|
"commit",
|
|
"-q",
|
|
"--allow-empty",
|
|
"-m",
|
|
"init",
|
|
],
|
|
cwd=repo,
|
|
check=True,
|
|
)
|
|
result = ver_mod._git_describe(repo)
|
|
assert result != "unknown"
|