From 250272a3be1ebde867ec503d8bc1195837ebba4a Mon Sep 17 00:00:00 2001 From: Andy Lee Date: Fri, 8 Aug 2025 10:28:19 -0700 Subject: [PATCH] fix: prevent test_document_rag_openai from hanging - Skip the test in CI environment to avoid hanging on OpenAI API calls - Add 60-second timeout decorator for local runs - Import ci_timeout from test_timeout module - The test uses OpenAI embeddings which can hang due to network/API issues --- tests/test_document_rag.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_document_rag.py b/tests/test_document_rag.py index ddd0bfd..1ced053 100644 --- a/tests/test_document_rag.py +++ b/tests/test_document_rag.py @@ -9,6 +9,7 @@ import tempfile from pathlib import Path import pytest +from test_timeout import ci_timeout @pytest.fixture @@ -59,8 +60,9 @@ def test_document_rag_simulated(test_data_dir): @pytest.mark.skipif(not os.environ.get("OPENAI_API_KEY"), reason="OpenAI API key not available") @pytest.mark.skipif( - os.environ.get("CI") == "true", reason="Skip OpenAI tests in CI to avoid API costs" + os.environ.get("CI") == "true", reason="Skip OpenAI embedding tests in CI to avoid hanging" ) +@ci_timeout(60) # 60 second timeout to avoid hanging on OpenAI API calls def test_document_rag_openai(test_data_dir): """Test document_rag with OpenAI embeddings.""" with tempfile.TemporaryDirectory() as temp_dir: