227 lines
15 KiB
Plaintext
227 lines
15 KiB
Plaintext
........................................................................ [ 37%]
|
|
.............................................FF......................... [ 74%]
|
|
.................................................. [100%]
|
|
=================================== FAILURES ===================================
|
|
_ test_old_profile_never_auto_backfilled_and_explicit_backfill_is_honest[11-1] _
|
|
|
|
tmp_path = PosixPath('/tmp/multica-task-631052398/pytest-of-xiaomo/pytest-0/test_old_profile_never_auto_ba0')
|
|
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fd04be47800>
|
|
hour = 11, life_count = 1
|
|
|
|
@pytest.mark.parametrize("hour,life_count", [(11, 1), (12, 0)])
|
|
def test_old_profile_never_auto_backfilled_and_explicit_backfill_is_honest(tmp_path, monkeypatch, hour, life_count):
|
|
app, _ = app_for(tmp_path, enabled=False)
|
|
with TestClient(app) as c:
|
|
c.post("/api/companion", json=CREATE)
|
|
turn(c)
|
|
s = app.state.store
|
|
birth = fingerprint(s)
|
|
raw = s.query_one("SELECT identity_json FROM companion")[0]
|
|
chats = [tuple(r) for r in s.query("SELECT * FROM chat_message")]
|
|
# Freeze only the runtime clock before lifespan starts, leaving the real loop enabled.
|
|
stamp = datetime(2026, 10, 24, hour, 11, tzinfo=ZoneInfo("Asia/Shanghai")).timestamp()
|
|
monkeypatch.setattr("cybergril.api.app.LifeRuntime",
|
|
lambda *args: LifeRuntime(*args, clock=lambda: stamp))
|
|
app2, p = app_for(tmp_path)
|
|
> with TestClient(app2) as c:
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
tests/test_r2.py:177:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/testclient.py:517: in __enter__
|
|
portal.call(self.wait_startup)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/anyio/from_thread.py:340: in call
|
|
return cast(T_Retval, self.start_task_soon(func, *args).result())
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py:456: in result
|
|
return self.__get_result()
|
|
^^^^^^^^^^^^^^^^^^^
|
|
/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py:401: in __get_result
|
|
raise self._exception
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/anyio/from_thread.py:265: in _call_func
|
|
retval = await retval_or_awaitable
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/testclient.py:552: in wait_startup
|
|
await receive()
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/testclient.py:543: in receive
|
|
self.task.result()
|
|
/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py:449: in result
|
|
return self.__get_result()
|
|
^^^^^^^^^^^^^^^^^^^
|
|
/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py:401: in __get_result
|
|
raise self._exception
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/anyio/from_thread.py:265: in _call_func
|
|
retval = await retval_or_awaitable
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/testclient.py:533: in lifespan
|
|
await self.app(scope, self.stream_receive.receive, self.stream_send.send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/fastapi/applications.py:1181: in __call__
|
|
await lifespan(
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/fastapi/telemetry/_runtime.py:238: in lifespan
|
|
await app(scope, wrapped_receive, wrapped_send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/applications.py:96: in __call__
|
|
await self.middleware_stack(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/middleware/errors.py:151: in __call__
|
|
await self.app(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/fastapi/telemetry/_asgi.py:151: in __call__
|
|
await self.app(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/middleware/exceptions.py:49: in __call__
|
|
await self.app(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/fastapi/middleware/asyncexitstack.py:18: in __call__
|
|
await self.app(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/routing.py:676: in __call__
|
|
await self.middleware_stack(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/fastapi/routing.py:2800: in app
|
|
await self.lifespan(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/routing.py:654: in lifespan
|
|
async with self.lifespan_context(app) as maybe_state:
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/contextlib.py:210: in __aenter__
|
|
return await anext(self.gen)
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
app = <fastapi.applications.FastAPI object at 0x7fd04be7fef0>
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app):
|
|
store = Store(db_path)
|
|
app.state.store = store
|
|
with store.conn:
|
|
store.execute(
|
|
"INSERT INTO api_meta(key,value) VALUES('epoch',1) ON CONFLICT(key) DO UPDATE SET value=value+1"
|
|
)
|
|
store.execute("UPDATE chat_message SET status='cancelled' WHERE status='pending'")
|
|
app.state.epoch = store.query_one("SELECT value FROM api_meta WHERE key='epoch'")["value"]
|
|
app.state.active = None
|
|
app.state.chat_lock = asyncio.Lock()
|
|
app.state.health_cache = (0, False)
|
|
app.state.health_lock = asyncio.Lock()
|
|
router.guard = PersistentBudget(store, router.guard)
|
|
app.state.sharing = Sharing(store, router, models)
|
|
app.state.persona = Persona(store, router, models, enabled=life_config.enabled)
|
|
app.state.public = PublicView(store)
|
|
app.state.memories = Memories(store, router, models, timezone=life_config.timezone)
|
|
app.state.memories.recover()
|
|
> app.state.life = LifeRuntime(store, router, models, life_config, app.state.sharing, app.state.persona,
|
|
memories=app.state.memories)
|
|
E TypeError: test_old_profile_never_auto_backfilled_and_explicit_backfill_is_honest.<locals>.<lambda>() got an unexpected keyword argument 'memories'
|
|
|
|
src/cybergril/api/app.py:213: TypeError
|
|
_ test_old_profile_never_auto_backfilled_and_explicit_backfill_is_honest[12-0] _
|
|
|
|
tmp_path = PosixPath('/tmp/multica-task-631052398/pytest-of-xiaomo/pytest-0/test_old_profile_never_auto_ba1')
|
|
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fd04c249970>
|
|
hour = 12, life_count = 0
|
|
|
|
@pytest.mark.parametrize("hour,life_count", [(11, 1), (12, 0)])
|
|
def test_old_profile_never_auto_backfilled_and_explicit_backfill_is_honest(tmp_path, monkeypatch, hour, life_count):
|
|
app, _ = app_for(tmp_path, enabled=False)
|
|
with TestClient(app) as c:
|
|
c.post("/api/companion", json=CREATE)
|
|
turn(c)
|
|
s = app.state.store
|
|
birth = fingerprint(s)
|
|
raw = s.query_one("SELECT identity_json FROM companion")[0]
|
|
chats = [tuple(r) for r in s.query("SELECT * FROM chat_message")]
|
|
# Freeze only the runtime clock before lifespan starts, leaving the real loop enabled.
|
|
stamp = datetime(2026, 10, 24, hour, 11, tzinfo=ZoneInfo("Asia/Shanghai")).timestamp()
|
|
monkeypatch.setattr("cybergril.api.app.LifeRuntime",
|
|
lambda *args: LifeRuntime(*args, clock=lambda: stamp))
|
|
app2, p = app_for(tmp_path)
|
|
> with TestClient(app2) as c:
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
tests/test_r2.py:177:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/testclient.py:517: in __enter__
|
|
portal.call(self.wait_startup)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/anyio/from_thread.py:340: in call
|
|
return cast(T_Retval, self.start_task_soon(func, *args).result())
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py:456: in result
|
|
return self.__get_result()
|
|
^^^^^^^^^^^^^^^^^^^
|
|
/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py:401: in __get_result
|
|
raise self._exception
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/anyio/from_thread.py:265: in _call_func
|
|
retval = await retval_or_awaitable
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/testclient.py:552: in wait_startup
|
|
await receive()
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/testclient.py:543: in receive
|
|
self.task.result()
|
|
/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py:449: in result
|
|
return self.__get_result()
|
|
^^^^^^^^^^^^^^^^^^^
|
|
/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py:401: in __get_result
|
|
raise self._exception
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/anyio/from_thread.py:265: in _call_func
|
|
retval = await retval_or_awaitable
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/testclient.py:533: in lifespan
|
|
await self.app(scope, self.stream_receive.receive, self.stream_send.send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/fastapi/applications.py:1181: in __call__
|
|
await lifespan(
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/fastapi/telemetry/_runtime.py:238: in lifespan
|
|
await app(scope, wrapped_receive, wrapped_send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/applications.py:96: in __call__
|
|
await self.middleware_stack(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/middleware/errors.py:151: in __call__
|
|
await self.app(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/fastapi/telemetry/_asgi.py:151: in __call__
|
|
await self.app(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/middleware/exceptions.py:49: in __call__
|
|
await self.app(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/fastapi/middleware/asyncexitstack.py:18: in __call__
|
|
await self.app(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/routing.py:676: in __call__
|
|
await self.middleware_stack(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/fastapi/routing.py:2800: in app
|
|
await self.lifespan(scope, receive, send)
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/starlette/routing.py:654: in lifespan
|
|
async with self.lifespan_context(app) as maybe_state:
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/contextlib.py:210: in __aenter__
|
|
return await anext(self.gen)
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
app = <fastapi.applications.FastAPI object at 0x7fd04c313a10>
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app):
|
|
store = Store(db_path)
|
|
app.state.store = store
|
|
with store.conn:
|
|
store.execute(
|
|
"INSERT INTO api_meta(key,value) VALUES('epoch',1) ON CONFLICT(key) DO UPDATE SET value=value+1"
|
|
)
|
|
store.execute("UPDATE chat_message SET status='cancelled' WHERE status='pending'")
|
|
app.state.epoch = store.query_one("SELECT value FROM api_meta WHERE key='epoch'")["value"]
|
|
app.state.active = None
|
|
app.state.chat_lock = asyncio.Lock()
|
|
app.state.health_cache = (0, False)
|
|
app.state.health_lock = asyncio.Lock()
|
|
router.guard = PersistentBudget(store, router.guard)
|
|
app.state.sharing = Sharing(store, router, models)
|
|
app.state.persona = Persona(store, router, models, enabled=life_config.enabled)
|
|
app.state.public = PublicView(store)
|
|
app.state.memories = Memories(store, router, models, timezone=life_config.timezone)
|
|
app.state.memories.recover()
|
|
> app.state.life = LifeRuntime(store, router, models, life_config, app.state.sharing, app.state.persona,
|
|
memories=app.state.memories)
|
|
E TypeError: test_old_profile_never_auto_backfilled_and_explicit_backfill_is_honest.<locals>.<lambda>() got an unexpected keyword argument 'memories'
|
|
|
|
src/cybergril/api/app.py:213: TypeError
|
|
=============================== warnings summary ===============================
|
|
../../../hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/fastapi/testclient.py:1
|
|
/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-829-8ee8ba59fefd/workdir/CyberGril/.venv312/lib/python3.12/site-packages/fastapi/testclient.py:1: StarletteDeprecationWarning: Using `httpx` with `starlette.testclient` is deprecated; install `httpx2` instead.
|
|
from starlette.testclient import TestClient as TestClient # noqa
|
|
|
|
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
|
|
=========================== short test summary info ============================
|
|
FAILED tests/test_r2.py::test_old_profile_never_auto_backfilled_and_explicit_backfill_is_honest[11-1]
|
|
FAILED tests/test_r2.py::test_old_profile_never_auto_backfilled_and_explicit_backfill_is_honest[12-0]
|
|
2 failed, 192 passed, 1 warning in 8.19s
|