python-testing-patterns
Skill2 starsChanged 5 months agoApache-2.0View on GitHub
Test conventions for the atlas project: pytest setup, fixture patterns, mocking external dependencies, and smoke test patterns. Use when writing new tests, setting up test infrastructure, or debugging a test failure.
30 other projects use a version of this.
Adopted by
Most recently taken up by
- theexperiencecompany/gaiatheir own version, first seen Nov 3, 2026
- jh941213/my-cc-harnesstheir own version, first seen Nov 1, 2026
- liushikuan63/Qoder-Optimizationtheir own version, first seen Nov 1, 2026
- jh941213/ADLC-harnesstheir own version, first seen Nov 1, 2026
- lza6/claw-code-tingfengtheir own version, first seen Oct 30, 2026
- KumailQazi/krmaazha-binance-mcptheir own version, first seen Oct 17, 2026
Used with
Projects with it also use docs-ci, docs-interfaces and 6 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
jh941213Skilldocs-ci
문서 CI(링크·OpenAPI lint·breaking 게이트·mermaid 검증)나 문서 드리프트 감지(docs.yaml 신선도 검사)를 설치하거나 돌릴 때 사용. 문서 내용 작성은 docs-architecture·docs-interfaces·docs-manuals.
Also in 3 projects that use this
jh941213Skilldocs-interfaces
API·이벤트 인터페이스 문서(OpenAPI·swagger·AsyncAPI 명세, 엔드포인트 레퍼런스, API 구성도·시퀀스, API CHANGELOG)를 만들거나 코드와 맞출 때 사용. 시스템 구성도는 docs-architecture, API 설계 원칙은 api-design-principles.
Also in 3 projects that use this
Aver005Skillpython-resource-management
Python resource management with context managers, cleanup patterns, and streaming. Use when managing connections, file handles, implementing cleanup logic, or building streaming responses with accumulated state.
Also in 4 projects that use this
Aver005Skillpython-design-patterns
Python design patterns including KISS, Separation of Concerns, Single Responsibility, and composition over inheritance. Use when making architecture decisions, refactoring code structure, or evaluating when abstractions are appropriate.
Also in 6 projects that use this
- +4 more from jh941213
Other versions30 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 30
- theexperiencecompany/gaia★ 325same name
- jh941213/ADLC-harness★ 125same name
- jh941213/my-cc-harness★ 125same name
- jh941213/my-claude-code-asset★ 125same name
- kumaran-is/claude-code-onboarding★ 35same name
- elimydlarz/gralkor★ 9same name
- xfstudio/skills★ 9same name
- VoVuongThanhDat/agentflow★ 8same name
- lza6/claw-code-tingfeng★ 5same name
- GPTtang/skill-atlas★ 4same name
20 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- architecture-decision-recordsSkill
- atlas-add-toolSkill
- atlas-build-bundleSkill
- atlas-ci-releaseSkill
- atlas-optimization-patternsSkill
- atlas-rag-evaluationSkill
- embedding-strategiesSkill
- hybrid-search-implementationSkill
- mcp-builderSkill
- python-code-styleSkill
- python-observabilitySkill
- python-resilienceSkill
- python-type-safetySkill
- readme-maintenanceSkill
- skill-creatorSkill
- uv-package-managerSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 0 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 29 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 40
Use conftest.py for shared fixtures.
- Very specific: line 98
Test write_manifest with and without embedding_dim.
- Very specific: line 99
Test write_chunks with sample chunk data.
- Very specific: line 104
Test Embedder base class contract (ABC).
- Very specific: line 105
Test OnnxEmbedder model resolution: snapshot_download path.
- Very specific: line 106
Test dim property from ONNX model shape.
- Very specific: line 107
Test MlxEmbedder zero-vector fallback.
“Common” is measured: kept by at least 6 in 10 of the 29 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
When to use
- Writing unit or integration tests for the project
- Setting up test infrastructure (conftest.py, fixtures)
- Adding tests for a new module
- Debugging a failing test
Prerequisites
Tests require the dev dependencies:
uv sync --extra devTest structure
Tests live in tests/ at the project root, mirroring atlas/:
tests/
├── conftest.py # Shared fixtures
├── test_chunk.py # Tests for atlas/chunk.py
├── test_make_bundle.py # Tests for atlas/make_bundle.py
└── test_embed/
├── conftest.py # Embedder fixtures
└── test_onnx.py # Tests for atlas/embed/onnx.pyFixture patterns
Use conftest.py for shared fixtures. Keep them scoped appropriately.
tests/conftest.py
from __future__ import annotations
from collections.abc import Generator
from pathlib import Path
import tempfile
import pytest
@pytest.fixture
def tmp_bundle_dir() -> Generator[Path, None, None]:
"""Provide a temporary directory for bundle output."""
with tempfile.TemporaryDirectory() as d:
yield Path(d)Mocking external dependencies
For tests that should not hit Hugging Face or the network:
@pytest.fixture(autouse=True)
def mock_hf_download(monkeypatch: pytest.MonkeyPatch) -> None:
"""Prevent accidental network calls during tests."""
def fake_download(*args, **kwargs) -> str:
return "/tmp/fake-model-dir"
monkeypatch.setattr(
"huggingface_hub.snapshot_download",
fake_download,
)For tests that need real ONNX inference, mark them as integration:
@pytest.mark.integration
def test_onnx_embedder_inference(onnx_embedder: OnnxEmbedder) -> None:
embeddings = onnx_embedder.embed(["hello world"])
assert embeddings.shape[1] == onnx_embedder.dimTest patterns by module
atlas/chunk.py
- Unit test
parse_frontmatterwith: valid YAML, malformed YAML, no frontmatter, empty file. - Unit test
_split_on_h2with: normal headings, no headings, consecutive headings, heading at EOF. - Integration test
chunk_fileagainst a real markdown file intests/fixtures/.
atlas/make_bundle.py
- Test
write_manifestwith and withoutembedding_dim. - Test
write_chunkswith sample chunk data. - Integration test: build a bundle from
tests/fixtures/docs and verify outputs.
atlas/embed/
- Test
Embedderbase class contract (ABC). - Test
OnnxEmbeddermodel resolution:snapshot_downloadpath. - Test
dimproperty from ONNX model shape. - Test
MlxEmbedderzero-vector fallback. - Mark GPU tests as
@pytest.mark.gpu(skipped when no GPU).
Coverage
- Target: 80%+ for utility modules (
chunk.py,make_bundle.py). - Core embedding paths: integration tests only (too costly to unit-test inference).
- Smoke test (
atlas-smoke): always runs end-to-end, never mocked — this is the CI gate.
Running tests
# All non-integration tests (fast)
uv run pytest -m "not integration and not gpu"
# Integration tests (requires model download)
uv run pytest -m integration
# Full suite
uv run pytestReferences
atlas/smoke_test.py— the end-to-end smoke test patternREADME.md§7 — testing roadmappyproject.toml— dev dependency (pytest>=8.0)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

