Fix skipif with empty env var (#6704)

This commit is contained in:
Silvano Cerza 2024-01-08 19:19:14 +01:00 committed by GitHub
parent 607e7d1488
commit 9445b2d466
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -164,7 +164,7 @@ class TestOpenAIDocumentEmbedder:
assert result["documents"] is not None
assert not result["documents"] # empty list
@pytest.mark.skipif("OPENAI_API_KEY" not in os.environ, reason="OPENAI_API_KEY is not set")
@pytest.mark.skipif(os.environ.get("OPENAI_API_KEY", "") == "", reason="OPENAI_API_KEY is not set")
@pytest.mark.integration
def test_run(self):
docs = [

View File

@ -76,7 +76,7 @@ class TestOpenAITextEmbedder:
with pytest.raises(TypeError, match="OpenAITextEmbedder expects a string as an input"):
embedder.run(text=list_integers_input)
@pytest.mark.skipif("OPENAI_API_KEY" not in os.environ, reason="OPENAI_API_KEY is not set")
@pytest.mark.skipif(os.environ.get("OPENAI_API_KEY", "") == "", reason="OPENAI_API_KEY is not set")
@pytest.mark.integration
def test_run(self):
model = "text-similarity-ada-001"

View File

@ -67,7 +67,7 @@ class TestIndexingPipeline:
with pytest.raises(ValueError, match="Could not find an embedder"):
build_indexing_pipeline(document_store=document_store, embedding_model="invalid_model")
@pytest.mark.skipif("OPENAI_API_KEY" not in os.environ, reason="OPENAI_API_KEY is not set")
@pytest.mark.skipif(os.environ.get("OPENAI_API_KEY", "") == "", reason="OPENAI_API_KEY is not set")
@pytest.mark.integration
def test_open_ai_embedding_model(self):
document_store = InMemoryDocumentStore()

View File

@ -8,7 +8,7 @@ from haystack.pipeline_utils.rag import build_rag_pipeline
from haystack.testing.factory import document_store_class
@pytest.mark.skipif("OPENAI_API_KEY" not in os.environ, reason="OPENAI_API_KEY is not set")
@pytest.mark.skipif(os.environ.get("OPENAI_API_KEY", "") == "", reason="OPENAI_API_KEY is not set")
@pytest.mark.integration
def test_rag_pipeline(mock_chat_completion):
rag_pipe = build_rag_pipeline(document_store=InMemoryDocumentStore())