python-testing
Python Testing guides you through pytest fundamentals, fixture management, and test-driven development for Python 3.9+ projects. It covers unit and integration testing, async validation, mocking strategies, and coverage configuration to help you build maintainable test suites that meet quality standards.
Python Testing helps you write and structure unit tests using pytest with proper patterns and best practices.
AI-generated summary based on this skill's SKILL.md
Install
athola/claude-night-market/python-testing · repository language: Python
git clone https://github.com/athola/claude-night-market
cp -r claude-night-market/plugins/parseltongue/skills/python-testing ~/.claude/skills/python-testingnpx skillfed install athola/claude-night-market/python-testingFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I write pytest tests in Python following best practices?
Python Testing teaches you to structure unit tests using the AAA pattern (Arrange, Act, Assert) with pytest. Start by organizing test files in a `tests/` directory, naming them `test_*.py`. Use descriptive test function names like `test_function_returns_expected_value()`. Python Testing covers proper assertions, test isolation, and how to leverage pytest's discovery mechanism to automatically find and run your tests.
What are pytest fixtures and how do I use them for test isolation?
Python Testing explains that fixtures are reusable test components defined with `@pytest.fixture` that provide setup and teardown logic. They enable test isolation by giving each test its own clean state. You can scope fixtures as `function`, `class`, `module`, or `session` depending on your needs. Python Testing shows how to use `conftest.py` to share fixtures across test modules and combine multiple fixtures in a single test.
How do I mock external dependencies with pytest?
Python Testing demonstrates mocking strategies using `unittest.mock` and pytest plugins. You can patch external calls with `@patch` decorators or use fixtures that return mock objects. Python Testing covers when to mock (external APIs, databases, file systems) versus when to use real objects, helping you avoid common anti-patterns and maintain fast, reliable tests that don't depend on external services.
How can I test asynchronous code with pytest-asyncio?
Python Testing covers async testing patterns using pytest-asyncio. Mark async test functions with `@pytest.mark.asyncio` and use `async def` syntax. Python Testing shows how to test coroutines, manage event loops, and structure fixtures for async workflows. It addresses timing issues and helps you validate that your async code behaves correctly under concurrent execution.
What pytest configuration options should I set in pyproject.toml?
Python Testing guides you through configuring pytest in `pyproject.toml` under `[tool.pytest.ini_options]`. Key settings include `testpaths` (where to find tests), `python_files` (test file naming), `addopts` (default command-line options), and `markers` (custom test markers). Python Testing also covers coverage configuration, minimum thresholds, and how to integrate linting and formatting tools into your test pipeline.
How do I set up test coverage reporting and enforce quality standards?
Python Testing explains coverage setup using `pytest-cov`, which measures how much of your code your tests exercise. Configure coverage thresholds in `pyproject.toml` to fail builds below a target percentage. Python Testing shows how to generate HTML reports, identify untested code paths, and use coverage data to improve test suite quality and catch gaps in your test-driven development workflow.
SKILL.md
rendered from the published skill — quoted content, verbatim
Python Testing Hub
Testing standards for pytest configuration, fixture management, and TDD implementation.
Table of Contents
Quick Start
- Dependencies:
pip install pytest pytest-cov pytest-asyncio pytest-mock - Configuration: Add the following to
pyproject.toml:toml [tool.pytest.ini_options] testpaths = ["tests"] addopts = "--cov=src"
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 7 files
plugins/parseltongue/skills/python-testing/SKILL.md
plugins/parseltongue/skills/python-testing/modules/async-testing.md
plugins/parseltongue/skills/python-testing/modules/fixtures-and-mocking.md
plugins/parseltongue/skills/python-testing/modules/test-infrastructure.md
plugins/parseltongue/skills/python-testing/modules/test-quality.md
plugins/parseltongue/skills/python-testing/modules/testing-workflows.md
plugins/parseltongue/skills/python-testing/modules/unit-testing.md