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
This commit is contained in:
Andy Lee
2025-08-08 10:28:19 -07:00
parent 042da1fe09
commit 250272a3be

View File

@@ -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: