test_runtime_resolution.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. """Keyless runtime-resolution tests; launch coverage lives in test_bundled_runtime.py."""
  2. from __future__ import annotations
  3. import pytest
  4. from deepseek_harness_runtime import (
  5. RUNTIME_MODE_ENV_VAR,
  6. bundled_default_config_path,
  7. bundled_package_dir,
  8. resolve_bundled_launch_args,
  9. )
  10. def test_default_config_is_shipped_with_the_package() -> None:
  11. path = bundled_default_config_path()
  12. assert path == bundled_package_dir() / "runtime" / "cordis.yml"
  13. config = path.read_text()
  14. assert "@deepseek-ai/dsh-agent-spine-demo" in config
  15. assert "@deepseek-ai/dsh-session-persistence-jsonl" in config
  16. assert "@deepseek-ai/dsh-session-checkpoint-policy" in config
  17. def test_unknown_explicit_mode_fails_loud() -> None:
  18. with pytest.raises(ValueError, match="expected 'exe' or 'node'"):
  19. resolve_bundled_launch_args("bogus")
  20. def test_unknown_env_mode_fails_loud(monkeypatch: pytest.MonkeyPatch) -> None:
  21. monkeypatch.setenv(RUNTIME_MODE_ENV_VAR, "bogus")
  22. with pytest.raises(ValueError, match="expected 'exe' or 'node'"):
  23. resolve_bundled_launch_args()
  24. def test_explicit_mode_wins_over_env_mode(monkeypatch: pytest.MonkeyPatch) -> None:
  25. monkeypatch.setenv(RUNTIME_MODE_ENV_VAR, "bogus")
  26. try:
  27. args = resolve_bundled_launch_args("exe")
  28. except FileNotFoundError:
  29. return # explicit 'exe' was honored; only the artifact is missing
  30. assert args[0].endswith(("-x64", "-arm64"))