Skip to content

chore(tests): hoist bm25-only fixture trio to conftest/helpers#529

Merged
memtomem merged 2 commits intomainfrom
chore/conftest-bm25-fixture-467
Apr 28, 2026
Merged

chore(tests): hoist bm25-only fixture trio to conftest/helpers#529
memtomem merged 2 commits intomainfrom
chore/conftest-bm25-fixture-467

Conversation

@memtomem
Copy link
Copy Markdown
Owner

Summary

  • PR fix(mem_batch_add): drop post-index tag broadcast; per-entry tags isolated #465 introduced test_batch_add_tag_isolation.py which redefined the _isolate_memtomem_env + _StubCtx + integration_components fixture trio that already lived in test_multi_agent_integration.py:56-127. Two copies was tolerable; a third would push it past the extraction threshold (fix(mem_batch_add): drop post-index tag broadcast; per-entry tags isolated #465 review N1).
  • conftest.py grows bm25_only_components (renamed from integration_components to make the BM25-only / hermetic-config scope visible at the call site).
  • helpers.py grows StubCtx and isolate_memtomem_env — the helper is exposed (not underscore-prefixed) because the LangGraph adapter cases construct their own MemtomemStore outside the fixture and need the helper directly.
  • Both test files drop their local copies. No behavior change.

Closes #467.

Test plan

  • uv run pytest packages/memtomem/tests/test_multi_agent_integration.py packages/memtomem/tests/test_batch_add_tag_isolation.py (23 passed)
  • uv run pytest packages/memtomem/tests/ -m "not ollama" (2999 passed, 46 deselected)
  • uv run ruff check + ruff format --check

🤖 Generated with Claude Code

pandas-studio and others added 2 commits April 28, 2026 14:14
PR #465 added ``test_batch_add_tag_isolation.py`` which redefined the
``_isolate_memtomem_env`` + ``_StubCtx`` + ``integration_components``
fixture trio that already lived almost verbatim in
``test_multi_agent_integration.py``. Two callers was tolerable; a third
would push it past the extraction threshold (per
feedback_refactor_axis.md / the #465 review N1).

- conftest.py grows the ``bm25_only_components`` fixture (renamed from
  ``integration_components`` so the BM25-only / hermetic-config scope is
  visible at the call site).
- helpers.py grows ``StubCtx`` and ``isolate_memtomem_env`` — the latter
  is exposed (not underscore-prefixed) because the LangGraph adapter
  cases construct their own ``MemtomemStore`` outside the fixture and
  need the helper directly.
- Both test files drop their local copies and import from the shared
  module. No behavior change; 23 tests in the two files still pass and
  the full suite (2999 tests) is green.

Closes #467.

Co-Authored-By: Claude <[email protected]>
P2 cron Phase A added the ``scheduler`` config section
(Mem2MemConfig.scheduler, BaseSettings-backed). A developer with
MEMTOMEM_SCHEDULER__ENABLED set in their shell would silently mutate
fixture-built configs. Add it to ``isolate_memtomem_env``'s strip list
so the helper covers every env-var-bound section that exists today.

Sibling sweep (per #529 review #5): ``_StubCtx`` duplicates also live
in test_sessions, test_validate_namespace, test_validate_namespace_ns_tools,
test_validate_agent_id, test_chunk_links_writer, test_server_degraded_mode
— left for a separate cleanup PR to keep #467's scope to the two files
named in the issue.

Co-Authored-By: Claude <[email protected]>
@memtomem
Copy link
Copy Markdown
Owner Author

Sibling sweep result (review #5): _StubCtx duplicates found in 6 other files — test_sessions, test_validate_namespace, test_validate_namespace_ns_tools (already imports from test_validate_namespace), test_validate_agent_id, test_chunk_links_writer (also has its own _isolate_memtomem_env), and test_server_degraded_mode. Left for a separate cleanup PR to keep this one's scope to the two files named in #467.

@memtomem memtomem merged commit 3edfc54 into main Apr 28, 2026
7 checks passed
@memtomem memtomem deleted the chore/conftest-bm25-fixture-467 branch April 28, 2026 05:25
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(tests): hoist integration_components fixture to conftest

2 participants