headroom/tests/test_memory
JD Davis 4e19bcf6ce
test(memory): skip decorators on offline model misses (#2020)
## Description

Current `main` already has the shared `external_model_skip_reason`
helper and pytest hooks for transient/offline model dependency failures.
This follow-up applies the same classifier to the async memory
integration test decorators in `test_core_operations.py` and
`test_easy.py`, so decorated tests also skip offline Hugging Face
cache-miss errors instead of only `httpx.ReadTimeout`.

Supersedes #1017 with a clean branch based on current `main`.

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)

## Changes Made

- Updated `network_timeout_handler` in
`tests/test_memory/test_core_operations.py` to call
`external_model_skip_reason` and re-raise unrelated exceptions.
- Updated `network_timeout_handler` in `tests/test_memory/test_easy.py`
the same way.
- Removed now-unnecessary direct `httpx` imports from those files.

## Testing

- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check`)
- [x] Type checking passes (`mypy` via commit hook)
- [x] New tests added for new functionality

### Test Output

```text
$ python -m pytest tests/test_memory/test_skip_helpers.py -q
4 passed in 0.12s

$ python -m ruff check tests/test_memory/test_core_operations.py tests/test_memory/test_easy.py tests/test_memory/test_skip_helpers.py
All checks passed!

$ python -m ruff format --check tests/test_memory/test_core_operations.py tests/test_memory/test_easy.py tests/test_memory/test_skip_helpers.py
3 files already formatted

$ git commit -m "test(memory): skip decorators on offline model misses"
Sync plugin versions.....................................................Passed
check for merge conflicts................................................Passed
ruff.....................................................................Passed
ruff-format..............................................................Passed
mypy.....................................................................Passed
```

## Real Behavior Proof

- Environment: Windows, Python 3.13.13, local `C:\git\headroom`
checkout.
- Exact command / steps: ran `python -m pytest
tests/test_memory/test_skip_helpers.py -q` against the skip classifier
used by these decorators.
- Observed result: `4 passed`, covering `httpx.ReadTimeout`,
`LocalEntryNotFoundError`, offline Hugging Face `OSError`, and unrelated
errors.
- Not tested: live memory integration against an intentionally missing
Hugging Face cache.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review
2026-07-11 10:14:05 -05:00
..
__init__.py Add persistent memory system with zero-latency inline extraction 2026-01-14 21:32:09 -08:00
conftest.py fix(ccr): skip Anthropic marker emission when tool injection is deferred (#1273) 2026-06-23 12:48:05 -05:00
test_budget.py Fix ruff lint errors in test files 2026-03-24 15:54:12 -07:00
test_core_operations.py test(memory): skip decorators on offline model misses (#2020) 2026-07-11 10:14:05 -05:00
test_easy.py test(memory): skip decorators on offline model misses (#2020) 2026-07-11 10:14:05 -05:00
test_embedder_mps_serialization.py fix(memory): cap local embedder CPU thread oversubscription (#198) (#1559) 2026-07-01 17:12:02 -05:00
test_embedder_thread_cap.py fix(memory): cap local embedder CPU thread oversubscription (#198) (#1559) 2026-07-01 17:12:02 -05:00
test_extraction.py Add hierarchical memory system with graph + vector storage 2026-01-26 21:58:47 -08:00
test_factory.py Add centralized ML model configuration 2026-02-01 23:47:42 -08:00
test_factory_external.py chore(memory): add EXTERNAL backend extension points 2026-04-20 16:42:10 -07:00
test_hierarchical.py fix(memory): batch onnx embeddings and sqlite-vec ops 2026-04-24 09:49:28 +00:00
test_learn_flag.py fix(traffic-learner): raise min-evidence default and make it configurable 2026-04-30 17:44:22 +09:00
test_mcp_server.py fix(codex): stop pinning Codex memory MCP to one project db (#1269) 2026-06-23 07:49:07 -05:00
test_qdrant_env.py feat(memory): resolve Qdrant connection from HEADROOM_QDRANT_* env vars (#31) 2026-04-24 22:16:16 -07:00
test_skip_helpers.py fix(ccr): skip Anthropic marker emission when tool injection is deferred (#1273) 2026-06-23 12:48:05 -05:00
test_traffic_learner.py feat: headroom wrap opencode / unwrap opencode CLI (#1105) 2026-06-22 11:07:12 -05:00
test_writers.py fix: harden learn path handling across platforms 2026-05-09 15:45:26 -07:00