nightshift/tests/test_version.py
K. Hodges 8b07876552 Improvement pass from llm
- tests/test_version.py: removed the brittle exact hotdog/topping/version assertion and kept the useful display contract.
  - nightshift/agents.py: normalized review next_stage / context_update values like None, null, and N/A to empty.
  - nightshift/git.py: added clearer non-git and Git safe-directory artifact messages with actionable guidance.
  - nightshift/cli.py: fixed run --all so completed dependencies remain in scope.
  - tests/test_agents.py, tests/test_git.py, tests/test_cli.py: added regression coverage.
  - docs/codex/20260521-next-improvements.md: marked the completed items.
2026-05-20 23:11:20 -07:00

42 lines
1.3 KiB
Python

import subprocess
import sys
import unittest
from nightshift.terminal import format_banner
from nightshift.version import (
HOTDOG_VERSIONS,
PACKAGE_VERSION,
TOPPING_VERSIONS,
display_version,
hotdog_version,
topping_version,
)
class VersionTests(unittest.TestCase):
def test_display_version_includes_channel_hotdog_and_topping(self) -> None:
self.assertTrue(display_version().startswith(f"{PACKAGE_VERSION}-alpha-"))
self.assertIn(hotdog_version, HOTDOG_VERSIONS)
self.assertIn(topping_version, TOPPING_VERSIONS)
self.assertIn(hotdog_version, display_version())
self.assertIn(topping_version, display_version())
def test_banner_uses_central_display_version(self) -> None:
self.assertIn(f"VERSION: {display_version()}", format_banner())
def test_cli_version_uses_central_display_version(self) -> None:
completed = subprocess.run(
[sys.executable, "-m", "nightshift.cli", "--version"],
capture_output=True,
text=True,
encoding="utf-8",
errors="replace",
check=True,
)
self.assertEqual(completed.stdout.strip(), f"nightshift {display_version()}")
if __name__ == "__main__":
unittest.main()