nightshift/tests/test_version.py
K. Hodges 2f2146f47d setup scripts improvement and what happened
- Added nightshift what-happened to summarize the latest run/task failure from artifacts.
  - Added integ-run --setup with setup options, so sandbox creation can immediately run integ-setup.
  - integ-setup output now explicitly shows the venv activation command.
  - Command stages now prefer a detected project/adjacent .venv, so python -m pytest -q should use the integ venv without relying on shell activation.
  - Retry command outputs now get attempt-specific artifact names, like test-output-1.txt, instead of overwriting.
  - Docs updated in README.md, the pastebin template README, and examples/tutorial/03-pastebin.
  - Added pytest config so root python -m pytest -q ignores generated integ/template target tests.
  - Version bumped to 0.2.4-alpha-bratwurst-relish.
2026-05-20 04:20:15 -07:00

41 lines
1.2 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.assertEqual(display_version(), "0.2.4-alpha-bratwurst-relish")
self.assertEqual(PACKAGE_VERSION, "0.2.4")
self.assertIn(hotdog_version, HOTDOG_VERSIONS)
self.assertIn(topping_version, TOPPING_VERSIONS)
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()