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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user