agentleFS
blackbenjaminblackbenjamin/etps/.claude/skills/python-testing/SKILL.md

python-testing

Skill1 starsChanged 11 months agoMITView on GitHub

Write pytest tests with fixtures, mocking, and async support. Use when writing unit tests, test files, test fixtures, or improving test coverage in backend/tests/.

53 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use django-verification, python-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.
  • mstuder-slalomSkill

    django-verification

    Verification loop for Django projects: migrations, linting, tests with coverage, security scans, and deployment readiness checks before release or PR.

    Also in 9 projects that use this

  • xenitV1Skill

    python-patterns

    Python development principles and decision-making. Framework selection, async patterns, type hints, project structure. Teaches thinking, not copying.

    Also in 22 projects that use this

  • HABUBUSSSkill

    project-guidelines-example

    Also in 8 projects that use this

  • AshfaqbsSkill

    springboot-tdd

    Test-driven development for Spring Boot using JUnit 5, Mockito, MockMvc, Testcontainers, and JaCoCo. Use when adding features, fixing bugs, or refactoring.

    Also in 7 projects that use this

  • mstuder-slalomSkill

    springboot-security

    Spring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.

    Also in 8 projects that use this

  • nek1987Skill

    postgres-patterns

    PostgreSQL patterns for reviewing migrations and writing efficient queries. Use when reviewing Alembic migrations, optimizing queries, or debugging database issues.

    Also in 15 projects that use this

  • +2 more from mstuder-slalom

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 48 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use pytest with pytest-asyncio for async code

    line 10
  2. Distinctive:

    All tests must pass before commits

    line 55
  3. Distinctive:

    Use fixtures for shared setup

    line 56
  4. Distinctive:

    Test async code with @pytest.mark.asyncio

    line 58
  5. Distinctive:

    Use descriptive assertion messages

    line 59
  6. Distinctive:

    Test edge cases and error conditions

    line 60

“Common” is measured: kept by at least 6 in 10 of the 48 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

Python Testing with Pytest

ETPS Test Structure

  • Tests live in backend/tests/test_*.py
  • Use pytest with pytest-asyncio for async code
  • Mock LLM: from services.llm.mock_llm import MockLLM
  • Current test count: 700+ passing

Test Pattern

import pytest
from services.llm.mock_llm import MockLLM

@pytest.mark.asyncio
async def test_my_function():
    mock_llm = MockLLM()
    result = await some_async_function(llm=mock_llm)
    assert result == expected

Running Tests

cd backend
python -m pytest -v                    # All tests
python -m pytest tests/test_file.py -v # Specific file
python -m pytest --tb=long             # Full tracebacks
python -m pytest -k "keyword"          # Filter by name

Key Test Files

  • test_pagination_allocation.py - Pagination service
  • test_bullet_rewriter.py - Bullet operations
  • test_critic.py - Quality evaluation
  • test_skill_gap.py - Skill analysis
  • test_text_output.py - Resume/cover letter text output
  • test_security.py - Security tests

Mocking Patterns

# Mock LLM
from services.llm.mock_llm import MockLLM
mock_llm = MockLLM()

# Mock database session
from unittest.mock import MagicMock
mock_db = MagicMock()

Best Practices

  1. All tests must pass before commits
  2. Use fixtures for shared setup
  3. Mock external services (LLM, vector store, APIs)
  4. Test async code with @pytest.mark.asyncio
  5. Use descriptive assertion messages
  6. Test edge cases and error conditions

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.