agentleFS
xsovad06xsovad06/sova/skills/testing-patterns/SKILL.md

testing-patterns

Skill2 starsChanged 3 months agoApache-2.0View on GitHub

Test conventions for {{ project_name }} -- pytest patterns, mock strategies, fixture patterns. Auto-activates when writing or modifying test files.

24 other projects use a version of this.

Adopted by

Most recently taken up by

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.
  • tiendatworkSkill

    intelligent-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

  • xfstudioSkill

    api-patterns

    API design principles and decision-making. REST vs GraphQL vs tRPC selection, response formats, versioning, pagination.

    Also in 5 projects that use this

  • xfstudioSkill

    rust-pro

    Master Rust 1.75+ with modern async patterns, advanced type system

    Also in 3 projects that use this

  • benshapyroSkill

    documentation-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

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 8 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When writing or modifying test files, follow these conventions.

    line 9
  2. Distinctive:

    Write tests that verify behavior, not implementation details

    line 19
  3. Distinctive:

    Use descriptive test names that explain the scenario and expected outcome

    line 20
  4. Distinctive:

    Prefer real implementations over mocks when practical

    line 22
  5. Very specific:

    Use autouse=True fixtures sparingly -- only for setup/teardown that every test needs

    line 28
  6. Very specific:

    Always use patch.object() for methods on instances

    line 34
  7. Distinctive:

    Verify mock calls when the call itself is the behavior under test

    line 35
  8. Distinctive:

    Do not assert mock call counts when only the return value matters

    line 36
  9. Distinctive:

    Use parametrize for testing multiple inputs with the same logic

    line 41
  10. Distinctive:

    Keep test files focused on one module or feature

    line 42

“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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Testing Patterns

When writing or modifying test files, follow these conventions.

Running Tests

{{ test_cmd }}

Key Principles

  • Write tests that verify behavior, not implementation details
  • Use descriptive test names that explain the scenario and expected outcome
  • Each test should be independent and not rely on execution order
  • Prefer real implementations over mocks when practical
  • Mock at system boundaries (external APIs, file I/O, databases), not internal interfaces

Fixture Patterns

  • Define fixtures per-file, not shared across test files
  • Use autouse=True fixtures sparingly -- only for setup/teardown that every test needs
  • Name fixtures descriptively: mock_api_client not client

Mock Rules

  • Patch at the import site, not the definition site
  • Always use patch.object() for methods on instances
  • Verify mock calls when the call itself is the behavior under test
  • Do not assert mock call counts when only the return value matters

Test Organization

  • Group related tests with classes
  • Use parametrize for testing multiple inputs with the same logic
  • Keep test files focused on one module or feature

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.