Files
odysseus/tests/test_cookbook_dependency_completion_regression.py
Wes Huber b30f02a3f0 fix(tests): align broken test assertions with current behavior (#1791)
* fix(tests): align broken test assertions with current behavior

- test_readme_native_quickstart_uses_loopback: README warning text
  moved from --host prefix to bind-to phrasing; update assertion
- test_sanitize_merges_consecutive_user_messages: consecutive user
  messages ARE merged and orphan tool messages ARE dropped by the
  adjacency repair pass; update expected counts and values

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(tests): update cookbook status poll assertion for stopped state

The cookbookRunning.js ternary now handles a 'stopped' status
alongside 'error', so the exact string match in the test no longer
holds. Relax the assertion to check for the error branch presence
instead of the full ternary expression.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-03 14:12:17 +09:00

42 lines
1.5 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def _read(rel_path: str) -> str:
return (ROOT / rel_path).read_text(encoding="utf-8")
def test_backend_status_treats_download_exit_zero_as_completed():
source = _read("routes/cookbook_routes.py")
assert "exit_match = re.search(r\"=== process exited with code\\s+(-?\\d+)\"" in source
assert "elif has_exit and task_type == \"download\":" in source
assert "status = \"completed\" if exit_code == 0 else \"error\"" in source
def test_background_status_poll_reconciles_into_local_tasks():
source = _read("static/js/cookbookRunning.js")
assert "const statusById = new Map(tasks.map(t => [t.session_id, t]));" in source
assert "const nextStatus = live.status === 'completed'" in source
assert "? 'done'" in source
assert "live.status === 'error'" in source
assert "_saveTasks(localTasks);" in source
assert "completedDeps.forEach(t => _refreshDepsAfterInstall(t));" in source
def test_dependency_install_payload_keeps_env_path_for_refresh():
source = _read("static/js/cookbook.js")
assert "env_path: _envState.envPath || ''" in source
def test_local_dependency_probe_refreshes_user_site_visibility():
source = _read("routes/shell_routes.py")
assert "importlib.invalidate_caches()" in source
assert "user_site = site.getusersitepackages()" in source
assert "if user_site and os.path.isdir(user_site) and user_site not in sys.path:" in source