66import pytest
77
88from cocoindex_code .config import _discover_codebase_root
9- from cocoindex_code .indexer import app
9+ from cocoindex_code .project import default_project
1010from cocoindex_code .query import query_codebase
1111
1212pytest_plugins = ("pytest_asyncio" ,)
@@ -194,7 +194,7 @@ async def test_index_and_query_codebase(
194194 ) -> None :
195195 """Should index a codebase and return relevant query results."""
196196 setup_base_codebase (test_codebase_root )
197- await app . update ( report_to_stdout = False )
197+ await ( await default_project ()). update_index ( )
198198
199199 # Verify index was created
200200 index_dir = test_codebase_root / ".cocoindex_code"
@@ -218,7 +218,7 @@ async def test_incremental_update_add_file(
218218 ) -> None :
219219 """Should reflect newly added files after re-indexing."""
220220 setup_base_codebase (test_codebase_root )
221- await app . update ( report_to_stdout = False )
221+ await ( await default_project ()). update_index ( )
222222
223223 # Query for ML content - should not find it
224224 results = await query_codebase ("machine learning neural network" )
@@ -232,7 +232,7 @@ async def test_incremental_update_add_file(
232232 (test_codebase_root / "ml_model.py" ).write_text (SAMPLE_ML_MODEL_PY )
233233
234234 # Re-index and query again
235- await app . update ( report_to_stdout = False )
235+ await ( await default_project ()). update_index ( )
236236 results = await query_codebase ("neural network machine learning" )
237237
238238 assert len (results ) > 0
@@ -244,13 +244,13 @@ async def test_incremental_update_modify_file(
244244 ) -> None :
245245 """Should reflect file modifications after re-indexing."""
246246 setup_base_codebase (test_codebase_root )
247- await app . update ( report_to_stdout = False )
247+ await ( await default_project ()). update_index ( )
248248
249249 # Modify utils.py to add authentication
250250 (test_codebase_root / "utils.py" ).write_text (SAMPLE_UTILS_AUTH_PY )
251251
252252 # Re-index and query for authentication
253- await app . update ( report_to_stdout = False )
253+ await ( await default_project ()). update_index ( )
254254 results = await query_codebase ("user authentication login" )
255255
256256 assert len (results ) > 0
@@ -264,7 +264,7 @@ async def test_incremental_update_delete_file(
264264 ) -> None :
265265 """Should no longer return results from deleted files after re-indexing."""
266266 setup_base_codebase (test_codebase_root )
267- await app . update ( report_to_stdout = False )
267+ await ( await default_project ()). update_index ( )
268268
269269 # Query for database - should find it
270270 results = await query_codebase ("database connection execute query" )
@@ -274,7 +274,7 @@ async def test_incremental_update_delete_file(
274274 (test_codebase_root / "lib" / "database.py" ).unlink ()
275275
276276 # Re-index and query again - should no longer find database.py
277- await app . update ( report_to_stdout = False )
277+ await ( await default_project ()). update_index ( )
278278 results = await query_codebase ("database connection execute query" )
279279 assert not any ("database.py" in r .file_path for r in results )
280280
@@ -335,7 +335,7 @@ class TestSearchFilters:
335335 async def test_filter_by_language (self , test_codebase_root : Path , coco_runtime : None ) -> None :
336336 """Should return only results matching the specified language."""
337337 setup_multi_lang_codebase (test_codebase_root )
338- await app . update ( report_to_stdout = False )
338+ await ( await default_project ()). update_index ( )
339339
340340 results = await query_codebase ("function" , limit = 50 , languages = ["python" ])
341341 assert len (results ) > 0
@@ -347,7 +347,7 @@ async def test_filter_by_language_multiple(
347347 ) -> None :
348348 """Should return results matching any of the specified languages."""
349349 setup_multi_lang_codebase (test_codebase_root )
350- await app . update ( report_to_stdout = False )
350+ await ( await default_project ()). update_index ( )
351351
352352 results = await query_codebase ("function" , limit = 50 , languages = ["python" , "javascript" ])
353353 assert len (results ) > 0
@@ -363,7 +363,7 @@ async def test_filter_by_file_path_glob(
363363 ) -> None :
364364 """Should return only results matching the file path glob pattern."""
365365 setup_multi_lang_codebase (test_codebase_root )
366- await app . update ( report_to_stdout = False )
366+ await ( await default_project ()). update_index ( )
367367
368368 results = await query_codebase ("function" , limit = 50 , paths = ["lib/*" ])
369369 assert len (results ) > 0
@@ -375,7 +375,7 @@ async def test_filter_by_file_path_wildcard_extension(
375375 ) -> None :
376376 """Should filter by file extension using glob wildcard."""
377377 setup_multi_lang_codebase (test_codebase_root )
378- await app . update ( report_to_stdout = False )
378+ await ( await default_project ()). update_index ( )
379379
380380 results = await query_codebase ("function" , limit = 50 , paths = ["*.js" ])
381381 assert len (results ) > 0
@@ -387,7 +387,7 @@ async def test_filter_by_both_language_and_file_path(
387387 ) -> None :
388388 """Should apply both language and file path filters together."""
389389 setup_multi_lang_codebase (test_codebase_root )
390- await app . update ( report_to_stdout = False )
390+ await ( await default_project ()). update_index ( )
391391
392392 # Filter for Python files under lib/
393393 results = await query_codebase ("function" , limit = 50 , languages = ["python" ], paths = ["lib/*" ])
@@ -401,7 +401,7 @@ async def test_no_filter_returns_all_languages(
401401 ) -> None :
402402 """Should return results from all languages when no filter is applied."""
403403 setup_multi_lang_codebase (test_codebase_root )
404- await app . update ( report_to_stdout = False )
404+ await ( await default_project ()). update_index ( )
405405
406406 results = await query_codebase ("function" , limit = 50 )
407407 languages_found = {r .language for r in results }
0 commit comments