test: fix stale _DummyInner mock signatures in test_embeddings.py#120
Merged
dcfocus merged 1 commit intoJun 28, 2026
Merged
Conversation
The hand-written `_DummyInner` stub in `test_embeddings.py` had `add` / `upsert` / `search` signatures that drifted from the real pyo3 bindings as they gained parameters (`tenant`, `source`, `run_id`, `created_at`, and the projection args). `Context.add` now passes 22 positional args to `_inner.add`, but the stub accepted at most 18 — so every test that exercised `add` / `upsert` failed with `TypeError: _DummyInner.add() takes from 10 to 18 positional arguments but 22 were given`, before reaching its assertion. These failures predated and were independent of any feature change; they weren't caught in CI because the Python test workflow's path doesn't match how the suite is invoked locally. Fix: capture only the leading arguments the tests assert on (`role`, `content`, `data_type`, `embedding`, and `external_id` for `upsert`) and absorb the rest with `*args, **kwargs`, so the stub no longer drifts when the real binding signatures grow. `test_embeddings.py`: 15 passed (was 8 failing). No production code changed.
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.
Summary
Fixes the stale
_DummyInnermock inpython/tests/test_embeddings.pywhoseadd/upsert/searchsignatures had drifted from the real pyo3 bindings.Context.addnow passes 22 positional args to_inner.add(the bindings gainedtenant,source,run_id,created_at, …), but the stub accepted at most 18 — so everyadd/upserttest failed at the call with:…before it ever reached its assertion. These failures pre-dated and were independent of any feature work, and weren't surfaced in CI (the Python test workflow's path doesn't match how the suite runs locally).
Fix
Capture only the leading arguments the tests assert on (
role,content,data_type,embedding, plusexternal_idforupsert) and absorb the rest with*args, **kwargs. The stub now won't drift again as binding signatures grow (e.g. the projection args added in #116).Test-only change — no production code touched.
Result
pytest python/tests/test_embeddings.py— 15 passed (was 8 failing).ruff format --check,ruff check,pyright— clean.Independent of the open feature PRs; based on
main.