jmservera/aithena/pytest-aithena-patterns
Claude Code and agent skill by jmservera/aithena
- community
Checking that the SKILL.md file is still in the repository.
Pytest fixture strategies, mock patterns, and service-specific testing quirks for aithena Python services
Install
npx vskill@latest install jmservera/aithena/pytest-aithena-patternsSKILL.md
Context
Use when writing or reviewing pytest tests for any aithena Python service. Covers fixture patterns, mock strategies, and per-service quirks that trip up new contributors.
Pattern 1: Frozen Dataclass Settings Patching
aithena config objects are frozen dataclasses. Normal monkeypatch.setattr() fails on them.
Use in conftest.py fixtures that need to override config for test isolation.
Pattern 2: Rate Limiter Cleanup (autouse fixture)
FastAPI rate limiters (e.g., login_rate_limiter) accumulate state across tests when using TestClient against the shared app instance.
Without this, later tests in the suite hit 429 Too Many Requests unexpectedly.
Pattern 3: Environment-Dependent Test Skipping
document-indexer has 4 tests that depend on RabbitMQ/Solr host env vars. Pattern:
This keeps CI green when infra isn't available while preserving tests for local/integration runs.
Pattern 4: Real-Library Corpus Fixtures
Tests that use real file paths from /home/jmservera/booklibrary should:
- Guard with
skipifso CI doesn't fail when library is unavailable - Use portable temp-path fixtures for canonical patterns
- Keep real-path tests for edge cases that can't be synthesized (OCR artifacts, old text encodings)
Pattern 5: FastAPI TestClient + Mocked Services
For integration tests against FastAPI endpoints:
Mock at the service boundary (Solr, Redis, RabbitMQ), not at the HTTP layer.
Service-Specific Quirks
| Service | Quirk | Workaround | |
|---|---|---|---|
| embeddings-server | requirements.txt lacks pytest, httpx | Run pip install pytest httpx before testing | |
| document-indexer | 4 tests skip without env vars | Set RABBITMQ_HOST, SOLR_HOST in CI env | |
| admin (Streamlit) | 19 InsecureKeyLengthWarning | Ignore — test-only HMAC keys, use 256-bit in prod | |
| all uv services | SSL errors in codespace | Set UV_NATIVE_TLS=1 before uv sync |
Anti-Patterns
- Don't mock the thing you're testing — mock external dependencies (Solr, Redis, RabbitMQ), not the service under test
- Don't use `monkeypatch` on frozen dataclasses — use
object.__setattr__()instead - Don't ignore rate limiter state — use autouse cleanup fixtures
- Don't hardcode real library paths without skipif — breaks CI
References
src/solr-search/tests/conftest.py— fixture examplessrc/solr-search/tests/test_auth.py— rate limiter + frozen settings patterns.squad/skills/path-metadata-tdd/— metadata-specific TDD patterns.squad/skills/tdd-clean-code/— general TDD principles
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.squad/skills/pytest-aithena-patterns/SKILL.md
Popularity
- Repository forks
- 1
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 20 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/jmservera/aithena/pytest-aithena-patterns)