From 4e3bcda5fadbcb561ab37d29c48e8311395c928c Mon Sep 17 00:00:00 2001 From: Andy Lee Date: Mon, 28 Jul 2025 23:16:51 -0700 Subject: [PATCH] fix: Update CI tests for new unified examples interface - Rename test_main_cli.py to test_document_rag.py - Update all references from main_cli_example.py to document_rag.py - Update tests/README.md documentation The tests now properly test the new unified interface while maintaining the same test coverage and functionality. --- tests/README.md | 4 ++-- ...{test_main_cli.py => test_document_rag.py} | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) rename tests/{test_main_cli.py => test_document_rag.py} (87%) diff --git a/tests/README.md b/tests/README.md index 06274fd..f73eb21 100644 --- a/tests/README.md +++ b/tests/README.md @@ -18,8 +18,8 @@ Basic functionality tests that verify: - Basic index building and searching works for both HNSW and DiskANN backends - Uses parametrized tests to test both backends -### `test_main_cli.py` -Tests the main CLI example functionality: +### `test_document_rag.py` +Tests the document RAG example functionality (formerly main_cli_example): - Tests with facebook/contriever embeddings - Tests with OpenAI embeddings (if API key is available) - Tests error handling with invalid parameters diff --git a/tests/test_main_cli.py b/tests/test_document_rag.py similarity index 87% rename from tests/test_main_cli.py rename to tests/test_document_rag.py index 4eb0e9f..30d5a9e 100644 --- a/tests/test_main_cli.py +++ b/tests/test_document_rag.py @@ -1,5 +1,5 @@ """ -Test main_cli_example functionality using pytest. +Test document_rag (formerly main_cli_example) functionality using pytest. """ import os @@ -20,14 +20,14 @@ def test_data_dir(): @pytest.mark.skipif( os.environ.get("CI") == "true", reason="Skip model tests in CI to avoid MPS memory issues" ) -def test_main_cli_simulated(test_data_dir): - """Test main_cli with simulated LLM.""" +def test_document_rag_simulated(test_data_dir): + """Test document_rag with simulated LLM.""" with tempfile.TemporaryDirectory() as temp_dir: # Use a subdirectory that doesn't exist yet to force index creation index_dir = Path(temp_dir) / "test_index" cmd = [ sys.executable, - "examples/main_cli_example.py", + "examples/document_rag.py", "--llm", "simulated", "--embedding-model", @@ -58,14 +58,14 @@ def test_main_cli_simulated(test_data_dir): @pytest.mark.skipif(not os.environ.get("OPENAI_API_KEY"), reason="OpenAI API key not available") -def test_main_cli_openai(test_data_dir): - """Test main_cli with OpenAI embeddings.""" +def test_document_rag_openai(test_data_dir): + """Test document_rag with OpenAI embeddings.""" with tempfile.TemporaryDirectory() as temp_dir: # Use a subdirectory that doesn't exist yet to force index creation index_dir = Path(temp_dir) / "test_index_openai" cmd = [ sys.executable, - "examples/main_cli_example.py", + "examples/document_rag.py", "--llm", "simulated", # Use simulated LLM to avoid GPT-4 costs "--embedding-model", @@ -99,12 +99,12 @@ def test_main_cli_openai(test_data_dir): ) -def test_main_cli_error_handling(test_data_dir): - """Test main_cli with invalid parameters.""" +def test_document_rag_error_handling(test_data_dir): + """Test document_rag with invalid parameters.""" with tempfile.TemporaryDirectory() as temp_dir: cmd = [ sys.executable, - "examples/main_cli_example.py", + "examples/document_rag.py", "--llm", "invalid_llm_type", "--index-dir",