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
DeleteAllAsyncTest
Mirrors: DeleteAllTest
| Test |
Description |
test_delete_all_documents_async |
Write 2 docs, delete all, count is 0; write 1 new doc, count is 1 |
test_delete_all_documents_empty_store_async |
delete_all_documents_async() on empty store doesn't raise, count stays 0 |
test_delete_all_documents_without_recreate_index_async |
Skipped if recreate_index/recreate_collection param not present; else tests False variant |
test_delete_all_documents_with_recreate_index_async |
Skipped if param not present; else tests True variant, verifies store still works after |
Use inspect.signature(document_store.delete_all_documents_async) to detect recreate_index/recreate_collection parameter (same pattern as sync DeleteAllTest._delete_all_supports_recreate).
DeleteByFilterAsyncTest
Mirrors: DeleteByFilterTest
| Test |
Description |
test_delete_by_filter_async |
Write 3 docs, delete 2 by category filter, verify 1 remains |
test_delete_by_filter_no_matches_async |
Filter matching nothing returns 0 deleted, store unchanged |
test_delete_by_filter_advanced_filters_async |
AND and OR compound filter deletions in sequence |
Use inspect.signature(document_store.delete_by_filter_async) to detect optional refresh parameter.
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-endDeleteAllAsyncTestMirrors:
DeleteAllTesttest_delete_all_documents_asynctest_delete_all_documents_empty_store_asyncdelete_all_documents_async()on empty store doesn't raise, count stays 0test_delete_all_documents_without_recreate_index_asyncrecreate_index/recreate_collectionparam not present; else testsFalsevarianttest_delete_all_documents_with_recreate_index_asyncTruevariant, verifies store still works afterDeleteByFilterAsyncTestMirrors:
DeleteByFilterTesttest_delete_by_filter_asynctest_delete_by_filter_no_matches_asynctest_delete_by_filter_advanced_filters_async