personal memory agent
0

Configure Feed

Select the types of activity you want to include in your feed.

solstone / tests / test_install_verify.py
2.2 kB 78 lines
1# SPDX-License-Identifier: AGPL-3.0-only 2# Copyright (c) 2026 sol pbc 3 4import ast 5import subprocess 6from pathlib import Path 7 8import pytest 9 10REPO_ROOT = Path(__file__).resolve().parents[1] 11VENV_PYTHON = REPO_ROOT / ".venv/bin/python" 12SOL_BIN = REPO_ROOT / ".venv/bin/sol" 13 14 15def _run_in_tmp(args: list[str]) -> subprocess.CompletedProcess[str]: 16 if not VENV_PYTHON.exists(): 17 pytest.skip("venv not installed") 18 return subprocess.run( 19 args, 20 cwd="/tmp", 21 timeout=30, 22 capture_output=True, 23 text=True, 24 ) 25 26 27def test_import_think_sol_compat_cli_from_tmp(): 28 result = _run_in_tmp( 29 [str(VENV_PYTHON), "-c", "from solstone.think.sol_compat_cli import main"] 30 ) 31 32 assert result.returncode == 0, result.stderr 33 34 35def test_import_think_media_from_tmp(): 36 result = _run_in_tmp( 37 [str(VENV_PYTHON), "-c", "from solstone.think.media import MIME_TYPES"] 38 ) 39 40 assert result.returncode == 0, result.stderr 41 42 43def test_sol_version_from_tmp(): 44 if not SOL_BIN.exists(): 45 pytest.skip("sol console script not installed") 46 47 result = _run_in_tmp([str(SOL_BIN), "--version"]) 48 49 assert result.returncode == 0, result.stderr 50 51 52def test_editable_finder_mapping_has_no_root_aliases(): 53 finder_paths = list( 54 (REPO_ROOT / ".venv" / "lib").glob( 55 "python*/site-packages/__editable___solstone_*_finder.py" 56 ) 57 ) 58 if not finder_paths: 59 pytest.skip("editable finder not installed") 60 61 module = ast.parse(finder_paths[0].read_text(encoding="utf-8")) 62 mapping = None 63 for node in module.body: 64 if isinstance(node, ast.Assign): 65 for target in node.targets: 66 if isinstance(target, ast.Name) and target.id == "MAPPING": 67 mapping = ast.literal_eval(node.value) 68 break 69 elif isinstance(node, ast.AnnAssign): 70 if isinstance(node.target, ast.Name) and node.target.id == "MAPPING": 71 mapping = ast.literal_eval(node.value) 72 else: 73 continue 74 if mapping is not None: 75 break 76 77 assert mapping is not None, "MAPPING assignment not found" 78 assert "sol" not in mapping and "media" not in mapping