test: fix test incorrectly marked as async (#9327)

* test: fix test incorrectly marked as async

* fix inmemory async tests
This commit is contained in:
Stefano Fiorucci 2025-04-30 16:07:30 +02:00 committed by GitHub
parent 201becd400
commit e3f9da13d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -894,7 +894,7 @@ class TestOpenAIChatGenerator:
assert message.meta["finish_reason"] == "stop"
assert message.meta["usage"]["prompt_tokens"] > 0
async def test_run_with_wrong_model(self):
def test_run_with_wrong_model(self):
mock_client = MagicMock()
mock_client.chat.completions.create.side_effect = OpenAIError("Invalid model name")

View File

@ -409,7 +409,7 @@ class TestMemoryDocumentStore(DocumentStoreBaseTests): # pylint: disable=R0904
# Test async/await methods and concurrency
@pytest.mark.asyncio
async def test_write_documents(self, document_store: InMemoryDocumentStore):
async def test_write_documents_async(self, document_store: InMemoryDocumentStore):
docs = [Document(id="1")]
assert await document_store.write_documents_async(docs) == 1
with pytest.raises(DuplicateDocumentError):
@ -443,7 +443,7 @@ class TestMemoryDocumentStore(DocumentStoreBaseTests): # pylint: disable=R0904
assert await document_store.count_documents_async() == 0
@pytest.mark.asyncio
async def test_bm25_retrieval(self, document_store: InMemoryDocumentStore):
async def test_bm25_retrieval_async(self, document_store: InMemoryDocumentStore):
# Tests if the bm25_retrieval method returns the correct document based on the input query.
docs = [Document(content="Hello world"), Document(content="Haystack supports multiple languages")]
await document_store.write_documents_async(docs)
@ -452,7 +452,7 @@ class TestMemoryDocumentStore(DocumentStoreBaseTests): # pylint: disable=R0904
assert results[0].content == "Haystack supports multiple languages"
@pytest.mark.asyncio
async def test_embedding_retrieval(self):
async def test_embedding_retrieval_async(self):
docstore = InMemoryDocumentStore(embedding_similarity_function="cosine")
# Tests if the embedding retrieval method returns the correct document based on the input query embedding.
docs = [