Agent skill · Testing & QA

python-testing

Python testing strategies using pytest, TDD methodology, fixtures, mocking, parametrization, and coverage requirements.

mturacgithub.com/mturacGitHub ↗
codexcopilotcursorMIT
Install
npx skills add mturac/everything-openai-codex --skill python-testing --agent codex

Same command for any agent — swap --agent for claude-code, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 18 KB
Bundled scripts: none
Path: skills/python-testing/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 84
Language: JavaScript

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

The skill instructs an agent to implement and apply Python testing strategies using pytest and TDD, including writing failing tests first, driving minimal code to pass, and refactoring. It emphasizes achieving high coverage (80%+), with 100% on critical paths, and using pytest commands to measure coverage. It provides concrete patterns for basic tests, assertions, fixtures (including setup/teardown, scopes, parameters, autouse, and conftest.py sharing), parametrization (basic, multiple, with IDs, and parametrized fixtures), markers and test selection, mocking and patching (functions, return values, exceptions, context managers, autospec, and class instances), testing async code (pytest-asyncio and async fixtures), testing exceptions and their attributes, testing side effects (file operations, tmp_path/tmpdir), and organizing tests by directory/file structure. It also covers best practices (do/don't) and common patterns for API endpoints and database operations.

How it works

  • Activate when writing new Python code, designing test suites, reviewing coverage, or setting up testing infrastructure.
  • Follow the Core Testing Philosophy: follow the TDD cycle (RED, GREEN, REFACTOR) with explicit code examples demonstrating each step.
  • Use pytest as the primary tool to run tests and measure coverage with commands such as pytest --cov and related reports.
  • Implement tests using the provided patterns: basic tests, fixtures (with and without teardown, scopes, parametrization, autouse, conftest.py sharing), and parametrization for multiple inputs.
  • Employ Mocking and Patching techniques to isolate code, including examples with unittest.mock.patch, autospec, and mocks for properties and async functions.
  • Write and organize tests for exceptions, side effects (file processing and temporary paths), and async code paths using pytest.mark.asyncio and async fixtures.
  • Structure tests into a directory layout (tests/unit, tests/integration, tests/e2e) and use class-based groupings where appropriate.
  • Emphasize best practices such as testing behavior over internals, maintaining test independence, and focusing on critical paths with adequate coverage.

When to use it

  • Writing new Python code (follow TDD: red, green, refactor)
  • Designing test suites for Python projects
  • Reviewing Python test coverage
  • Setting up testing infrastructure

What it can touch

  • It references and demonstrates usage of Python tooling and patterns; the explicit tools named include pytest, and code constructs such as @pytest.fixture, @pytest.mark.parametrize, @patch, with pytest.raises, and file operation helpers. It does not specify external systems beyond typical Python testing libraries.

Caveats

  • License: MIT
  • Declares support for common testing scenarios but does not guarantee test outcomes or applicability to all projects; follows standard TDD and pytest conventions as shown. The content is a collection of patterns and examples; adoption requires adapting to project specifics.
From the SKILL.md

# Python Testing Patterns Comprehensive testing strategies for Python applications using pytest, TDD methodology, and best practices. ## When to Activate - Writing new Python code (follow TDD: red, green, refactor) - Designing test suites for Python projects - Reviewing Python test coverage - Setting up testing infrastructure ## Core Testing Philosophy ### Test-Driven Development (TDD) Always follow the TDD cycle: 1. **RED**: Write a failing test for the desired behavior 2. **GREEN**: Write minimal code to make the test pass 3. **REFACTOR**: Improve code while keeping tests green ```python # Step 1: Write failing test (RED) def test_add_numbers(): result = add(2, 3) assert result == 5 # Step 2: Write minimal implementation (GREEN) def add(a, b): return a + b # Step 3: Refactor if needed (REFACTOR) ``` ### Coverage Requirements - **Target**: 80%+ code coverage - **Critical paths**: 100% coverage required - Use `pytest --cov` to measure coverage ```bash pytest --cov=mypackage --cov-report=term-missing --cov-report=html ``` ## pytest Fundamentals ### Basic Test Structure ```python import pytest def test_addition(): """Test basic addition.""" assert 2 + 2 == 4 def test_string_uppercase

What's inside
Steps it walks through
  1. When to Activate
  2. Core Testing Philosophy
  3. Test-Driven Development (TDD)
  4. Coverage Requirements
  5. pytest Fundamentals
  6. Basic Test Structure
  7. Assertions
  8. Fixtures
  9. Basic Fixture Usage
  10. Fixture with Setup/Teardown
  11. Fixture Scopes
  12. Fixture with Parameters
  13. Using Multiple Fixtures
  14. Autouse Fixtures
Commands it runs
pytest --cov=mypackage --cov-report=term-missing --cov-report=html
Run only fast tests
pytest -m "not slow"
Run only integration tests
pytest -m integration
Run integration or slow tests
pytest -m "integration or slow"
Run tests marked as unit but not slow
pytest -m "unit and not slow"
Run all tests
More from everything-openai-codex
All skills →
About this skill
What does the python-testing skill do?

Python testing strategies using pytest, TDD methodology, fixtures, mocking, parametrization, and coverage requirements.

How do I install it?

Run `npx skills add mturac/everything-openai-codex --skill python-testing --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From mturac/everything-openai-codex, a repository with 84 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going