Skip to content

Commit e3f9da1

Browse files
authored
test: fix test incorrectly marked as async (#9327)
* test: fix test incorrectly marked as async * fix inmemory async tests
1 parent 201becd commit e3f9da1

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

test/components/generators/chat/test_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ def test_live_run(self):
894894
assert message.meta["finish_reason"] == "stop"
895895
assert message.meta["usage"]["prompt_tokens"] > 0
896896

897-
async def test_run_with_wrong_model(self):
897+
def test_run_with_wrong_model(self):
898898
mock_client = MagicMock()
899899
mock_client.chat.completions.create.side_effect = OpenAIError("Invalid model name")
900900

test/document_stores/test_in_memory.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def test_multiple_document_stores_using_same_index(self):
409409
# Test async/await methods and concurrency
410410

411411
@pytest.mark.asyncio
412-
async def test_write_documents(self, document_store: InMemoryDocumentStore):
412+
async def test_write_documents_async(self, document_store: InMemoryDocumentStore):
413413
docs = [Document(id="1")]
414414
assert await document_store.write_documents_async(docs) == 1
415415
with pytest.raises(DuplicateDocumentError):
@@ -443,7 +443,7 @@ async def test_delete_documents(self, document_store: InMemoryDocumentStore):
443443
assert await document_store.count_documents_async() == 0
444444

445445
@pytest.mark.asyncio
446-
async def test_bm25_retrieval(self, document_store: InMemoryDocumentStore):
446+
async def test_bm25_retrieval_async(self, document_store: InMemoryDocumentStore):
447447
# Tests if the bm25_retrieval method returns the correct document based on the input query.
448448
docs = [Document(content="Hello world"), Document(content="Haystack supports multiple languages")]
449449
await document_store.write_documents_async(docs)
@@ -452,7 +452,7 @@ async def test_bm25_retrieval(self, document_store: InMemoryDocumentStore):
452452
assert results[0].content == "Haystack supports multiple languages"
453453

454454
@pytest.mark.asyncio
455-
async def test_embedding_retrieval(self):
455+
async def test_embedding_retrieval_async(self):
456456
docstore = InMemoryDocumentStore(embedding_similarity_function="cosine")
457457
# Tests if the embedding retrieval method returns the correct document based on the input query embedding.
458458
docs = [

0 commit comments

Comments
 (0)