import subprocess import sys import tomllib from pathlib import Path from trex_core import __version__ ROOT = Path(__file__).resolve().parents[1] def test_runtime_version_matches_project_metadata(): project = tomllib.loads((ROOT / "pyproject.toml").read_text()) assert __version__ == project["project"]["version"] def test_all_console_modules_display_the_release_version(): for module, command in ( ("trex_core.runtime.cli", "trex-core"), ("trex_core.runtime.daemon", "trex-core-daemon"), ("trex_core.runtime.reset", "trex-core-reset"), ): result = subprocess.run( [sys.executable, "-m", module, "--version"], cwd=ROOT, check=True, capture_output=True, text=True, ) assert result.stdout.strip() == f"{command} {__version__}"