testing-python

Guide writing and evaluating Python tests with pytest.

17|2|Updated Jun 5, 2025
One-click install
npx skills add https://github.com/AI-Riksarkivet/ra-mcp --skill testing-python-ai-riksarkivet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-python
Source: https://github.com/AI-Riksarkivet/ra-mcp/tree/main/packages/viewer-mcp/.claude/skills/testing-python
Command: npx skills add https://github.com/AI-Riksarkivet/ra-mcp --skill testing-python-ai-riksarkivet

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write, review, and debug Python tests more effectively, ensuring code quality and reliability.

Core Features & Use Cases

  • Test Design: Learn principles for writing atomic, self-contained tests.
  • Parameterization: Use pytest's parameterization for testing variations of the same concept.
  • Async Testing: Understand how to write async tests without unnecessary decorators.
  • Mocking: Learn best practices for mocking external dependencies.
  • Use Case: When you've written a new feature in Python, use this Skill to ensure your tests are robust, cover edge cases, and are easy to maintain.

Quick Start

Use the testing-python skill to write a new pytest test for the calculate_discount function.

Frequently Asked Questions about testing-python

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

FAQPage Schema
How do I write effective Python tests using pytest?

Writing effective Python tests with pytest involves designing atomic, self-contained tests that evaluate single functionalities, utilizing fixtures and parameterization to cover variations, and applying mocking for external dependencies to ensure robust code quality.

What is the best way to parameterize tests in pytest?

The best way to parameterize tests in pytest is to use its built-in parameterization features to test variations of the same concept. This approach allows you to run the same test logic against multiple input combinations efficiently.

How does mocking work for external dependencies in Python unit tests?

Mocking external dependencies in Python unit tests involves substituting real services with simulated objects. This ensures tests remain atomic and self-contained, preventing external factors from causing false test failures while improving code quality and debugging.

Do I need special decorators for async testing in pytest?

You do not need unnecessary decorators for async testing in pytest. The testing-python guidance helps you understand how to write and evaluate async tests directly, streamlining your test suite for asynchronous Python code.

When should I use pytest fixtures in my Python testing?

You should use pytest fixtures when you need to establish reusable, consistent contexts for your Python tests. Fixtures help ensure your tests are self-contained and atomic, which is highly recommended for maintaining code quality.