testing-patterns
Skill3 starsChanged 4 days 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.
44 other projects use a version of this.
Adopted by
Most recently taken up by
- gopalparashar421/agent-skillstheir own version, first seen Nov 8, 2026
- soilmass/motion-design-agenttheir own version, first seen Nov 8, 2026
- seandkendall/kiro-configtheir own version, first seen Nov 1, 2026
- svngoku/coding-agents-skillstheir own version, first seen Nov 1, 2026
- piomin/claude-ai-spring-boottheir own version, first seen Oct 25, 2026
- piomin/claude-ai-quarkustheir own version, first seen Oct 25, 2026
Used with
Projects with it also use intelligent-routing, bash-linux 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.
SKB3002Skillintelligent-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 5 projects that use this
xenitV1Skillbash-linux
Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.
Also in 6 projects that use this
xenitV1Skillred-team-tactics
Red team tactics principles based on MITRE ATT&CK. Attack phases, detection evasion, reporting.
Also in 6 projects that use this
ChrisWilesSkillformik-patterns
Formik form handling with validation patterns. Use when building forms, implementing validation, or handling form submission.
Also in 3 projects that use this
SKB3002Skillnextjs-react-expert
React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.
Also in 3 projects that use this
adybaSkillsafe-workflow
SAFe Agentic Workflow orchestrator. Teaches the full SAFe methodology adapted for AI agents: pattern discovery, exit states, quality gates, agent personas, and specs-driven development. Use when setting up a project with SAFe workflow, understanding the multi-agent methodology, or coordinating work across agent personas. Triggers: "SAFe workflow", "agent workflow", "safe harness", "specs-driven", "exit states", "quality gates", "multi-agent workflow".
Also in 3 projects that use this
- +4 more from xenitV1
Other versions44 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 44
- vudovn/ag-kit★ 8.2ksame name
- vudovn/antigravity-kit★ 8.2ksame name
- ChrisWiles/claude-code-showcase★ 6.1ksame name
- ag2ai/faststream★ 5.4ksame name
- piomin/claude-ai-spring-boot★ 1.4ksame name
- bybren-llc/safe-agentic-workflow★ 405same name
- dilolabs/nosia★ 211same name
- xenitV1/Antigravity-Workflows★ 130same name
- langchain-ai/skills-benchmarks★ 116same name
- leather-io/mono★ 28same name
34 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 repository44 other files it gives its agents.
- AGENTS.mdAGENTS.md
- templates/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- templates/CLAUDE.mdCLAUDE.md
- dashboard-designSkill
- database-patternsSkill
- design-systemSkill
- design-tasteSkill
- issue-templateSkill
- sova-address-prSkill
- sova-after-mergeSkill
- sova-agent-readinessSkill
- sova-audit-instructionsSkill
- sova-debugSkill
- sova-develop-explainSkill
- sova-develop-fullSkill
- sova-developSkill
- sova-extract-knowledgeSkill
- sova-find-taskSkill
- sova-health-auditSkill
- sova-ingest-reviewSkill
- sova-integrate-prSkill
- sova-issueSkill
- sova-new-featureSkill
- sova-optimize-knowledgeSkill
- sova-prSkill
- sova-rearrange-commitsSkill
- sova-researchSkill
- sova-review-fullSkill
- sova-review-prSkill
- sova-reviewSkill
- sova-simplifySkill
- sova-specSkill
- sova-standupSkill
- sova-statusSkill
- sova-testSkill
- sova-update-docsSkill
- testing-patternsSkill
- visual-auditSkill
- dashboard-designSkill
- database-patternsSkill
- design-tasteSkill
- issue-templateSkill
- visual-auditSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.
0
Common
Most of the 29 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
3
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 78
Multi-call methods: use side_effect list.
- Very specific: line 83
Session pattern: always async with await get_session() as session:.
- Distinctive: line 89
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 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
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- Most tests are flat in
tests/; a few isolated areas (e.g.tests/runtime/) get their own subdirectory with a localconftest.pywhen their fixtures don't apply elsewhere tests/conftest.pyholds only truly cross-suite fixtures:_isolate_sova_env(autouse, strips ambientSOVA_*env vars) andseed_config(seeds DB-backedproject_settingsinstead of writingsova.toml, matching production config storage). Useseed_config(project_dir, **values)for any test that needs configured values, don't write asova.tomlfile.- Tests grouped with classes. Beyond the shared fixtures above, fixtures are defined per-file, not shared.
Required Fixtures
In-memory DB (autouse in any file touching ORM):
@pytest.fixture(autouse=True)
async def setup_db(monkeypatch):
monkeypatch.setenv("SOVA_DATABASE_URL", "sqlite+aiosqlite://")
await init_db(run_migrations=False)
yield
await close_db()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:
Exception: when the code under test imports inside the function body (# Correct patch("sova.adapters.github.run", new_callable=AsyncMock) # Wrong patch("sova.utils.shell.run", new_callable=AsyncMock)from x import yin the function), there is no module-level binding to patch, so patch the source module (x.y). Leave a one-line comment at the patch site so a reviewer does not "fix" it back.
1b. Environment variables: always monkeypatch.setenv/delenv, never assign to or pop from os.environ directly. A direct mutation outlives a failing test and leaks into every later test in the process.
- 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". - Don't add new shared fixtures to
tests/conftest.pybeyond_isolate_sova_env/seed_config: copy per-file helpers instead, unless the fixture is genuinely needed suite-wide. - A new module-level cache or lock dict needs an autouse clear fixture in the same PR: any
_cache: dictor_locks: dict[..., asyncio.Lock]added tosova/gets an autouse fixture that.clear()s it before and after each test. Anasyncio.Lockis bound to the event loop that first used it, so a stale one leaks across tests and can bypass active patches. - A regression or concurrency test must fail with the fix reverted: before trusting it, revert the fix locally and watch it fail. A
gather()test whose mocks never suspend (noawait asyncio.sleep(0)orasyncio.Eventbarrier) runs sequentially and proves nothing about concurrency. - 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 (e.g.
TestIsIssuealongside code that always mocks_is_issue()). - Cover except blocks explicitly for the SonarCloud gate: swallowed-error handlers (
except (OSError, Exception)) add uncovered lines that can fail thenew_coveragethreshold (80%) even on a small diff. Add a test withside_effect=OSError(...)(or the specific exception) that triggers each except path; for file I/O,patch.object(Path, "read_text"/"write_text", side_effect=OSError(...))covers read and write failures independently. 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 (close to CI, not identical: see docs/testing-guidelines.md)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.

