Add the repo-side pieces for milestone 5: MIT licensing, real maintainer and forge metadata, a public support doc, 1.0.0 release notes, release-prep tooling, and CI uploads for the full candidate artifact set. Keep source-tree version surfaces honest by reading the local project version in the CLI and About dialog, and cover the new release-prep plus version-fallback behavior with focused tests. Document where raw validation evidence belongs, add the GA validation rollup, and archive the latest readiness review. Milestone 5 remains open until the forge release page is published and the milestone 2 and 3 matrices are filled with linked manual evidence. Validation: PYTHONPATH=src python3 -m unittest discover -s tests -p 'test_*.py'; PYTHONPATH=src python3 -m unittest tests.test_release_prep tests.test_portable_bundle tests.test_aman_cli tests.test_config_ui; python3 -m py_compile src/*.py tests/*.py; PYTHONPATH=src python3 -m aman version
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SRC = ROOT / "src"
|
|
if str(SRC) not in sys.path:
|
|
sys.path.insert(0, str(SRC))
|
|
|
|
from config import Config
|
|
from config_ui import (
|
|
RUNTIME_MODE_EXPERT,
|
|
RUNTIME_MODE_MANAGED,
|
|
_app_version,
|
|
apply_canonical_runtime_defaults,
|
|
infer_runtime_mode,
|
|
)
|
|
from unittest.mock import patch
|
|
|
|
|
|
class ConfigUiRuntimeModeTests(unittest.TestCase):
|
|
def test_infer_runtime_mode_defaults_to_managed(self):
|
|
cfg = Config()
|
|
self.assertEqual(infer_runtime_mode(cfg), RUNTIME_MODE_MANAGED)
|
|
|
|
def test_infer_runtime_mode_detects_expert_overrides(self):
|
|
cfg = Config()
|
|
cfg.models.allow_custom_models = True
|
|
self.assertEqual(infer_runtime_mode(cfg), RUNTIME_MODE_EXPERT)
|
|
|
|
def test_apply_canonical_runtime_defaults_resets_expert_fields(self):
|
|
cfg = Config()
|
|
cfg.stt.provider = "local_whisper"
|
|
cfg.models.allow_custom_models = True
|
|
cfg.models.whisper_model_path = "/tmp/custom-whisper.bin"
|
|
|
|
apply_canonical_runtime_defaults(cfg)
|
|
|
|
self.assertEqual(cfg.stt.provider, "local_whisper")
|
|
self.assertFalse(cfg.models.allow_custom_models)
|
|
self.assertEqual(cfg.models.whisper_model_path, "")
|
|
|
|
def test_app_version_prefers_local_pyproject_version(self):
|
|
pyproject_text = '[project]\nversion = "9.9.9"\n'
|
|
|
|
with patch("config_ui.Path.exists", return_value=True), patch(
|
|
"config_ui.Path.read_text", return_value=pyproject_text
|
|
), patch("config_ui.importlib.metadata.version", return_value="1.0.0"):
|
|
self.assertEqual(_app_version(), "9.9.9")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|