Skip to content
Merged
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 .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ body:
id: version
attributes:
label: ToolTrace Bench version
placeholder: "0.1.0 (pip show tooltrace-bench)"
placeholder: "output of: tooltrace --version"
validations:
required: true
- type: textarea
Expand Down
35 changes: 35 additions & 0 deletions tests/test_version_is_reportable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""`tooltrace --version` works today; this keeps it working and honest.

The sibling project api-verity-lab carried `__version__ = "0.1.0"` in the
package while `pyproject.toml` said 0.2.0 — nothing tested the two against
each other, so the drift sat there. This repo prints FRAMEWORK_VERSION from
`tooltrace.core.versions`, which is a third place the number can be written
down; all three have to agree.
"""

from __future__ import annotations

import pathlib
import tomllib

import pytest
from tooltrace.cli.main import main
from tooltrace.core.versions import FRAMEWORK_VERSION

PYPROJECT = pathlib.Path(__file__).resolve().parents[1] / "pyproject.toml"


def _declared_version() -> str:
data = tomllib.loads(PYPROJECT.read_text(encoding="utf-8"))
return str(data["project"]["version"])


def test_framework_version_matches_pyproject() -> None:
assert _declared_version() == FRAMEWORK_VERSION


def test_version_flag_exits_zero_and_prints_the_version(
capsys: pytest.CaptureFixture[str],
) -> None:
assert main(["--version"]) == 0
assert capsys.readouterr().out.strip() == FRAMEWORK_VERSION