AgentStack
SKILL verified Apache-2.0 Self-run

Testing Python

skill-qte77-claude-code-plugins-testing-python · by qte77

Writes tests following TDD Red-Green-Refactor (pytest + Hypothesis). Tests behavior, not implementation. Use when writing unit tests, integration tests, or property tests.

No reviews yet
0 installs
14 views
0.0% view→install

Install

$ agentstack add skill-qte77-claude-code-plugins-testing-python

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Testing Python? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Python Testing

Target: $ARGUMENTS

Writes focused, behavior-driven tests following project testing strategy.

Quick Reference

TDD methodology (language-agnostic): See tdd-core plugin (testing-tdd skill)

Python-specific documentation: references/

  • references/testing-strategy.md - Python tools (pytest, Hypothesis, inline-snapshot)
  • references/tdd-best-practices.md - Python TDD examples (extends tdd-core)

Approach

TDD only: pytest for known cases, Hypothesis for edge cases, inline-snapshot for regression. Tests assert observable behavior — inputs produce expected outputs/side-effects. No Gherkin, no feature files, no step definitions.

See references/testing-strategy.md for tool selection guide.

TDD Essentials (Quick Reference)

Cycle: RED (failing test) → GREEN (minimal pass) → REFACTOR (clean up)

Structure: Arrange-Act-Assert (AAA)

def test_order_processor_calculates_total():
    # ARRANGE
    items = [Item(price=10.00, qty=2), Item(price=5.00, qty=1)]
    processor = OrderProcessor()

    # ACT
    total = processor.calculate_total(items)

    # ASSERT
    assert total == 25.00

Hypothesis Priorities (Edge Cases within TDD)

| Priority | Area | Example | | ---------- | ------ | --------- | | CRITICAL | Math formulas | Scores always in bounds | | CRITICAL | Loop termination | Never hangs | | HIGH | Input validation | Handles any text | | HIGH | Serialization | Always valid JSON |

What to Test (KISS/DRY/YAGNI)

High-Value: Business logic, integration points, edge cases, contracts

Avoid: Library behavior, trivial assertions, implementation details, default constants, stale fixture patches (see references/testing-strategy.md → "Patterns to Remove")

See references/testing-strategy.md → "Patterns to Remove" for full list.

Naming Convention

Format: test_{module}_{component}_{behavior}

test_user_service_creates_new_user()
test_order_processor_validates_items()

Execution

make test              # All tests
make test_rerun        # Rerun failed tests (fast iteration)
make validate          # Full pre-commit validation
pytest tests/ -v       # Verbose
pytest -k test_user_   # Filter by name

Quality Gates

  • [ ] All tests pass (make test)
  • [ ] TDD Red-Green-Refactor followed
  • [ ] Arrange-Act-Assert structure used
  • [ ] Naming convention followed
  • [ ] Behavior-focused (not implementation)
  • [ ] No library behavior tested
  • [ ] Mocks for third-party types use spec=RealClass

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.