test: Supabase - increase unit tests coverage - #3796
Draft
julian-risch wants to merge 3 commits into
Draft
Conversation
Contributor
Coverage report (supabase)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
Cover the code paths that were only reachable through the integration-marked tests, which the unit coverage badge excludes. Nearly all of the gap was in groonga_document_store.py. The filter translation is exercised through a small recording stand-in for the PostgREST query builder, so the tests assert the query that gets generated rather than that some method was called: - _apply_condition: every comparison operator, the null-inclusive rewrites for != and "not in" on meta fields, ISO-date handling, and all six FilterError paths - _apply_filters: AND recursion, the OR and NOT expression building including the extra is.null clause NOT(field==value) needs, and the rejections of nested and inexpressible operators - _meta_col: the -> vs ->> choice across numbers, text, booleans, None and lists; _normalize_value for booleans - _match_condition / _match_document: the in-memory matching used on PGroonga results The client-boundary methods are driven through mocked sync and async clients, asserting the calls made rather than round-tripped data: write_documents for every DuplicatePolicy, filter/count/delete/update by filter, _groonga_retrieval, table setup including recreate_table, the warm_up guards, and every async twin. Also adds the missing warm_up error path for SupabaseBucketDownloader. Unit coverage: 48% -> 99%. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
julian-risch
force-pushed
the
test/supabase-unit-coverage
branch
from
August 18, 2026 09:26
0782b60 to
3c727d6
Compare
Applies the review feedback from #3794 to this PR. - Lift the async mock-client fixture pair into `conftest.py` too. Only the sync pair was shared before, so `test_groonga_document_store.py` kept its own async pair and the new tests added a third, near-identical one. - Rename the shared fixtures to `mock_groonga_client` / `mock_groonga_store` (plus the async variants). `mock_supabase_client` only ever mocked the Groonga store's client, which is misleading now that it sits in a conftest shared with the pgvector and bucket-downloader tests. - Drop `test_groonga_document_store_unit.py` and merge it into `test_groonga_document_store.py`. The `_unit` suffix carried no meaning — both files were unit tests, the integration ones live in `test_groonga_integration.py` — and it split adjacent code paths across files: in-memory filter matching was tested in both. - Split the resulting file, and `TestRetriever`, into focused test classes (`TestInit`, `TestWarmUp`, `TestSerde`, `TestRun`, ...). One duplicate goes away: `test_write_documents_empty` and `test_writing_nothing_is_a_no_op` asserted the same thing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Proposed Changes:
_apply_filtersand_apply_condition(both were 0%), exercised through a small recording stand-in for the PostgREST query builder so the tests assert the query that gets generated._meta_col,_normalize_value,_match_condition, and the client-boundary methods with mocked sync and async clients.tests/conftest.py; it was duplicated verbatim intest_groonga_document_store.pyandtest_groonga_retriever.py.How did you test it?
Notes for the reviewer
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.