Files
claude-seo/tests/test_runtime_installers.py
Agrici Daniel 0c79ca93fa build: require Python 3.11 to 3.14 and pick a supported interpreter
Python 3.10 reached end of life on 2026-10-01, and the Pillow 13.0.0
security release (28 advisories, no 12.x backport) needs 3.11, so
requirements.txt now sets pillow>=13.0.0 and the floor moves to 3.11.
Python 3.15 is not supported yet: google-ads declares < 3.15.

The range lives in runtime.py (MIN_PYTHON, MAX_PYTHON). setup refuses an
interpreter outside it and doctor reports one. scripts/claude-seo and
install.ps1 keep a supported default, otherwise take the newest of 3.14 down
to 3.11, so 'py -3' resolving to 3.15 on new Windows runner images no longer
breaks installs. install.ps1 now honors CLAUDE_SEO_PYTHON.

CI tests 3.11, 3.12 and 3.14, runs the network tests on 3.11, audits
dependencies on 3.11 and 3.14, and the Windows smoke runs doctor with the
interpreter the venv was built from. tests/test_python_range.py keeps every
copy of the range in step and drives the launcher with stub interpreters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 5123df4476d28211fe03f2eb88bbe4af4aebec24)
2026-10-22 19:01:43 +03:00

47 lines
1.8 KiB
Python

"""Static installer/runtime contract checks that do not mutate a real home."""
import os
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
def test_unix_installer_delegates_to_runtime_without_global_pip() -> None:
text = (ROOT / "install.sh").read_text(encoding="utf-8")
assert '"${SKILL_DIR}/scripts/claude-seo" setup' in text
assert "pip install --user" not in text
assert "python3 -m venv" not in text
assert '"${CLAUDE_PLUGIN_ROOT}/scripts/claude-seo" run' in text
assert '"${CLAUDE_PLUGIN_ROOT}/scripts/claude-seo" setup' in text
assert '"${CLAUDE_PLUGIN_ROOT}/scripts/claude-seo" doctor' in text
assert '"${runtime_status}" -ne 0 ] && [ "${runtime_status}" -ne 10' in text
assert 'find "${HOME}/.claude/skills"' not in text
def test_windows_installer_delegates_to_runtime_without_path_mutation() -> None:
text = (ROOT / "install.ps1").read_text(encoding="utf-8")
assert "scripts\\runtime.py" in text
assert "'setup'" in text
assert "SetEnvironmentVariable('PATH'" not in text
assert "pip','install" not in text
assert "UTF8Encoding($false)" in text
assert "(3, $MinMinor) <= sys.version_info[:2] <= (3, $MaxMinor)" in text
assert "$runtime.ExitCode -ne 0 -and $runtime.ExitCode -ne 10" in text
assert "-Directory -Filter 'seo*'" not in text
@pytest.mark.skipif(
os.name != "posix", reason="the executable bit is a POSIX mode bit; Windows has none"
)
def test_launcher_is_executable() -> None:
assert (ROOT / "scripts/claude-seo").stat().st_mode & 0o100
def test_launcher_uses_safe_exec() -> None:
text = (ROOT / "scripts/claude-seo").read_text(encoding="utf-8")
assert 'exec "${CLAUDE_SEO_PYTHON}" "${runtime}" "$@"' in text
assert 'exec "$@" "${runtime}" "${script_args[@]+"${script_args[@]}"}"' in text
assert "eval " not in text