DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
test: synchronize session restoration and turn cleanup
Bingxi Zhao (Frank)8ed5fe040e15
diff --git a/tests/api/test_unified_ws_turn_runtime.py b/tests/api/test_unified_ws_turn_runtime.pyindex 28c7cccb5..4d4fd3d4f 100644--- a/tests/api/test_unified_ws_turn_runtime.py+++ b/tests/api/test_unified_ws_turn_runtime.py@@ -1,5 +1,6 @@from __future__ import annotations+import asynciofrom types import SimpleNamespaceimport pytest@@ -23,13 +24,16 @@ def _fake_skill_service() -> SimpleNamespace:@pytest.fixture(autouse=True)-def _isolate_runtime_skills(monkeypatch):+def _isolate_runtime_services(monkeypatch):# Runtime now resolves multiple skill libraries; these turn tests use an# empty catalog and must not inspect the developer's real skill folders.monkeypatch.setattr("deeptutor.services.skill.runtime.skill_sources",lambda **kwargs: [(_fake_skill_service(), None, "account")],)+ # Title generation has its own tests. Fake turn providers must not start+ # an unrelated online LLM call after emitting their final stream event.+ monkeypatch.setattr(TurnRuntimeManager, "_maybe_generate_session_title", _noop_async)def _fake_persona_service() -> SimpleNamespace:@@ -495,8 +499,13 @@ async def test_turn_runtime_persists_llm_selection_in_turn_snapshot(})+ execution = runtime._executions[turn["id"]]+ assert execution.task is not Noneasync for _event in runtime.subscribe_turn(turn["id"], after_seq=0):pass+ # A replay subscriber can observe DONE before the runner's finally block.+ # Model-scope reset is an execution cleanup assertion, not a stream one.+ await asyncio.wait_for(execution.task, timeout=5)detail = await store.get_session_with_messages(session["id"])assert detail is not Nonediff --git a/web/tests/e2e/video-learning.audit.ts b/web/tests/e2e/video-learning.audit.tsindex 427e82646..e61b56d3a 100644--- a/web/tests/e2e/video-learning.audit.ts+++ b/web/tests/e2e/video-learning.audit.ts@@ -102,6 +102,7 @@ for (const mobile of [false, true]) {current = 0duration = 120rate = 1+ ready = falseelement: HTMLElementoptions: Record<string, unknown>@@ -124,6 +125,7 @@ for (const mobile of [false, true]) {onReady?: (event: { target: FakePlayer }) => void}events.onReady?.({ target: this })+ this.ready = true})}@@ -475,6 +477,9 @@ for (const mobile of [false, true]) {.poll(() => transcriptList.evaluate(element => element.scrollTop)).toBeGreaterThan(pausedScrollTop)+ const previousPlayer = await page.evaluateHandle(() => (+ window as typeof window & { __fakePlayers: Array<object> }+ ).__fakePlayers.at(-1))if (mobile) await page.getByRole('button', { name: 'Conversation', exact: true }).click()await page.locator('textarea').fill('Explain the video')await page.locator('textarea').press('Enter')@@ -484,6 +489,17 @@ for (const mobile of [false, true]) {workspace_mode: 'immersive_watching',timed_media_id: MATERIAL_ID,})+ // The URL changes before the session bridge restores its player. Wait+ // for the replacement controller so the seek cannot land on the old one.+ await expect.poll(() => page.evaluate(previous => {+ const current = (+ window as typeof window & {+ __fakePlayers: Array<{ ready: boolean; element: HTMLElement }>+ }+ ).__fakePlayers.at(-1)+ return !!current && current !== previous && current.ready && current.element.isConnected+ }, previousPlayer)).toBe(true)+ await previousPlayer.dispose()if (mobile) await page.getByRole('button', { name: 'Video', exact: true }).click()await page.evaluate(() => {const player = (