testing-patterns
Skill2 starsChanged 3 months agoApache-2.0View on GitHub
SOVA test conventions: pytest async patterns, mock strategies, fixture patterns, dashboard ASGI testing. Auto-activates when writing or modifying test files in the tests/ directory.
24 other projects use a version of this.
Adopted by
Most recently taken up by
- dafaalz/agent-skillstheir own version, first seen Sep 22, 2026
- Dregxmoon/Kaoru-Agenttheir own version, first seen Sep 15, 2026
- VoDaiLocz/kilo-kit-mcptheir own version, first seen Aug 21, 2026
- TheHiddenDeveloper/jarvis-skillstheir own version, first seen Aug 19, 2026
- svngoku/coding-agents-skillstheir own version, first seen Aug 13, 2026
- bybren-llc/safe-agentic-workflowtheir own version, first seen Jul 20, 2026
Used with
Projects with it also use intelligent-routing, api-patterns and 10 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.
tiendatworkSkillintelligent-routing
Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.
Also in 3 projects that use this
xfstudioSkillapi-patterns
API design principles and decision-making. REST vs GraphQL vs tRPC selection, response formats, versioning, pagination.
Also in 5 projects that use this
xfstudioSkillrust-pro
Master Rust 1.75+ with modern async patterns, advanced type system
Also in 3 projects that use this
benshapyroSkilldocumentation-templates
Generates README files, API documentation, and inline code comments following best practices. Use when creating project documentation, writing READMEs, documenting APIs, or explaining complex code.
Also in 3 projects that use this
- +8 more from xfstudio
Other versions24 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 24
- ChrisWiles/claude-code-showcase★ 6.1ksame name
- bybren-llc/safe-agentic-workflow★ 419same name
- langchain-ai/skills-benchmarks★ 118same name
- VoDaiLocz/kilo-kit-mcp★ 27same name
- 4444J99/a-i--skills★ 17same name
- svngoku/coding-agents-skills★ 11same name
- wpank/ai★ 11same name
- DIL8654/claude-code-dotnet-template★ 9same name
- Dregxmoon/Kaoru-Agent★ 9same name
- xfstudio/skills★ 9same name
14 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 repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- templates/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- templates/CLAUDE.mdCLAUDE.md
- dashboard-designSkill
- database-patternsSkill
- source-command-extract-knowledgeSkill
- source-command-rearrange-commitsSkill
- visual-auditSkill
- dashboard-designSkill
- database-patternsSkill
- design-tasteSkill
- issue-templateSkill
- testing-patternsSkill
- visual-auditSkill
- design-systemSkill
- issue-templateSkill
- testing-patternsSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.
0
Common
Most of the 17 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
When writing or modifying files in tests/, follow these conventions.
- Very specific: line 14
All tests flat in tests/: no subdirectories, no conftest.py
- Very specific: line 70
Multi-call methods: use side_effect list.
- Very specific: line 75
Session pattern: always async with await get_session() as session:.
- Distinctive: line 79
Direct unit tests for mocked functions: if a function is always mocked in integration tests, SonarCloud flags 0% coverage.
“Common” is measured: kept by at least 6 in 10 of the 17 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
SOVA Testing Patterns
When writing or modifying files in tests/, follow these conventions. Reference: docs/testing-guidelines.md.
Framework
asyncio_mode = "auto": no@pytest.mark.asyncioneeded on async tests- All tests flat in
tests/: no subdirectories, noconftest.py - Tests grouped with classes. Fixtures defined per-file, not shared.
Required Fixtures
In-memory DB (autouse in any file touching ORM):
@pytest.fixture(autouse=True)
async def setup_db():
os.environ["SOVA_DATABASE_URL"] = "sqlite+aiosqlite://"
await init_db(run_migrations=False)
yield
await close_db()
os.environ.pop("SOVA_DATABASE_URL", None)Dashboard client:
@pytest.fixture
async def client(tmp_path):
app = create_app(project_dir=tmp_path)
transport = ASGITransport(app=app)
async with AsyncClient(transport=transport, base_url="http://test") as ac:
yield acMock Rules
- Patch at the import site, not the definition site:
# Correct patch("sova.adapters.github.run", new_callable=AsyncMock) # Wrong patch("sova.utils.shell.run", new_callable=AsyncMock) - Use
patch.objectfor split modules: patch the actual submodule, not the re-export facade:patch.object(agent_lifecycle, "_get_project_agents", return_value=pa) - ShellResult factory: define per-file:
def _shell_result(stdout="", stderr="", returncode=0): return ShellResult(returncode=returncode, stdout=stdout, stderr=stderr) - Context factory: define per-file:
def _make_ctx(**kwargs) -> ExecutionContext: defaults = {"project_dir": Path("/tmp/test"), "config": ProjectConfig(), "adapter": _mock_adapter(), "issue_number": "42", "role": "developer"} defaults.update(kwargs) return ExecutionContext(**defaults) - Multi-call methods: use
side_effectlist.
Pitfalls
- Clear caches: file-backed services (handoff, log) cache by mtime. Clear
_handoff_cachesin tests. - Session pattern: always
async with await get_session() as session:. - DB fixture scope: per-test only. Never
scope="module". - No conftest.py: copy helpers per-file, don't share.
- Module-level cache requires
setup_methodin ALL test classes: when a service function has a module-level cache, addsetup_method: clear_cache()to every test class in the file that calls it, not just new ones. Cache type changes (tuple|None->dict) require updating all reset patterns (= None->.clear()). - Direct unit tests for mocked functions: if a function is always mocked in integration tests, SonarCloud flags 0% coverage. Add a dedicated test class with direct calls to cover the implementation paths.
MagicMock(name="foo")sets repr, not.name:name=is a reserved constructor arg. Assign after construction:mock = MagicMock(); mock.name = "foo".- Spawn mock functions must use
**kwargs:async def _capture_spawn(prompt, cwd, **kwargs)absorbs new parameters without breaking whenspawn()gains kwargs. TaskRunusesstarted_at, notcreated_at: most ORM models usecreated_at, butTaskRunusesstarted_at/ended_at. ReferencingTaskRun.created_atraisesAttributeErrorsilently swallowed by broadexcept Exception.
Running
make checkbefore push (CI-equivalent)make test-pyfor pytest onlymake lintfor ShellCheck + Ruff
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.

