NOTES:
- Tests should be written into
haystack/testing/document_store_async.py
- Use
async def for all test methods
- Decorate each test method with
@pytest.mark.asyncio
- Rely on an
async-compatible document_store fixture (to be provided by the concrete test class in each integration)
- Use
await on all *_async() calls
- Use
write_documents_async / count_documents_async in setup steps (not the sync variants), so the full async path is exercised end-to-end
- Open the PR to the async-mixin-tests feature branch
UpdateByFilterAsyncTest(FilterableDocsFixtureMixin)
Mirrors: UpdateByFilterTest
| Test |
Description |
test_update_by_filter_async |
Update meta on matching docs, verify updated and non-updated docs |
test_update_by_filter_no_matches_async |
Filter matches nothing, returns 0, store count unchanged |
test_update_by_filter_multiple_fields_async |
Update multiple meta fields at once |
test_update_by_filter_advanced_filters_async |
AND/OR compound filter updates |
Use inspect.signature(document_store.update_by_filter_async) to detect optional refresh parameter.
CountDocumentsByFilterAsyncTest
Mirrors: CountDocumentsByFilterTest
| Test |
Description |
test_count_documents_by_filter_simple_async |
Simple equality filter |
test_count_documents_by_filter_compound_async |
AND filter |
test_count_documents_by_filter_no_matches_async |
Filter matches nothing, returns 0 |
test_count_documents_by_filter_empty_collection_async |
Empty store returns 0 |
CountUniqueMetadataByFilterAsyncTest
Mirrors: CountUniqueMetadataByFilterTest
| Test |
Description |
test_count_unique_metadata_by_filter_all_documents_async |
No filter — distinct counts for all docs across multiple fields |
test_count_unique_metadata_by_filter_with_filter_async |
Simple filter narrows the distinct value counts |
test_count_unique_metadata_by_filter_with_multiple_filters_async |
AND compound filter |
NOTES:
haystack/testing/document_store_async.pyasync deffor all test methods@pytest.mark.asyncioasync-compatibledocument_storefixture (to be provided by the concrete test class in each integration)awaiton all*_async()callswrite_documents_async/count_documents_asyncin setup steps (not the sync variants), so the full async path is exercised end-to-endUpdateByFilterAsyncTest(FilterableDocsFixtureMixin)Mirrors:
UpdateByFilterTesttest_update_by_filter_asynctest_update_by_filter_no_matches_asynctest_update_by_filter_multiple_fields_asynctest_update_by_filter_advanced_filters_asyncCountDocumentsByFilterAsyncTestMirrors:
CountDocumentsByFilterTesttest_count_documents_by_filter_simple_asynctest_count_documents_by_filter_compound_asynctest_count_documents_by_filter_no_matches_asynctest_count_documents_by_filter_empty_collection_asyncCountUniqueMetadataByFilterAsyncTestMirrors:
CountUniqueMetadataByFilterTesttest_count_unique_metadata_by_filter_all_documents_asynctest_count_unique_metadata_by_filter_with_filter_asynctest_count_unique_metadata_by_filter_with_multiple_filters_async