python-testing

Guide pytest-based testing and TDD workflows for Python reliability.

1|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/samymity/bridge-ventures-backend --skill python-testing-samymity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-testing
Source: https://github.com/samymity/bridge-ventures-backend/tree/main/.claude/skills/python-testing
Command: npx skills add https://github.com/samymity/bridge-ventures-backend --skill python-testing-samymity

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps teams write correct, maintainable Python tests and achieve trustworthy coverage by applying pytest best practices, TDD discipline, and robust mocking.

Core Features & Use Cases

  • TDD workflow guidance: Follow the RED → GREEN → REFACTOR cycle to design tests around desired behavior.
  • Coverage requirements: Target 80%+ overall coverage with 100% on critical paths using pytest-cov reports.
  • Practical pytest techniques: Use fixtures (scoped and parameterized), parametrization, markers for test selection, and mocking/patching for external dependencies.
  • Testing robustness: Cover exceptions, assertions, side effects (tmp_path/tmpdir), and async code via pytest-asyncio.

Quick Start

Ask the skill to draft a pytest test strategy for a new Python module, including fixtures, mocking plan for external calls, parametrized test cases, and a coverage approach aligned to 80%+ overall and 100% critical paths.

Frequently Asked Questions about python-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write pytest tests for async Python functions?

You can test async Python code by applying pytest-asyncio patterns to handle asynchronous test execution. This skill provides guidance on writing async test cases and asserting side effects within your pytest workflow.

What's the best way to enforce code coverage requirements in pytest?

The best way to enforce code coverage is by using pytest-cov reporting commands to target 80%+ overall coverage and 100% on critical paths. This skill guides you in configuring coverage enforcement for your modules.

How do I mock external dependencies in pytest tests?

You mock external dependencies in pytest by using mocking and patching techniques to isolate test environments. This skill helps you design a mocking plan for external calls to ensure robust and reliable test execution.

Can I use parametrization and fixtures together in pytest?

Yes, you can use parametrization alongside scoped and parameterized fixtures in pytest to run data-driven tests. This skill provides practical patterns for combining these techniques to maximize test coverage efficiently.

How does the TDD workflow improve Python code reliability?

The TDD workflow improves Python reliability by following the RED, GREEN, and REFACTOR cycle to design tests around desired behavior. This skill guides you in applying test-driven development discipline to produce maintainable code.

Does pytest work with temporary directories for side-effect testing?

Yes, pytest works with temporary directories using tmp_path and tmpdir to test side effects safely. This skill covers asserting side effects and file operations within isolated temporary environments.