MCPcopy Create free account
hub / github.com/cocoindex-io/cocoindex-code / daemon_project

Function daemon_project

tests/test_daemon.py:121–135  ·  view source on GitHub ↗

Create and index a project once for the session. Returns project_root str.

(daemon_sock: str)

Source from the content-addressed store, hash-verified

119
120@pytest.fixture(scope="session")
121def daemon_project(daemon_sock: str) -> str:
122 """Create and index a project once for the session. Returns project_root str."""
123 project = Path(tempfile.mkdtemp(prefix="ccc_proj_"))
124 save_project_settings(project, default_project_settings())
125 (project / "main.py").write_text(SAMPLE_MAIN_PY)
126
127 conn = Client(daemon_sock, family=connection_family())
128 conn.send_bytes(encode_request(HandshakeRequest(version=__version__)))
129 decode_response(conn.recv_bytes())
130 conn.send_bytes(encode_request(IndexRequest(project_root=str(project))))
131 _updates, final = _recv_index_response(conn)
132 assert final.success is True
133 conn.close()
134
135 return str(project)
136
137
138def _connect_and_handshake(sock_path: str) -> tuple[Connection, Response]:

Callers

nothing calls this directly

Calls 9

save_project_settingsFunction · 0.90
default_project_settingsFunction · 0.90
connection_familyFunction · 0.90
encode_requestFunction · 0.90
HandshakeRequestClass · 0.90
decode_responseFunction · 0.90
IndexRequestClass · 0.90
_recv_index_responseFunction · 0.85
closeMethod · 0.80

Tested by

no test coverage detected