pytest-describe
Describe-style plugin for pytest
What it is and what it does
pytest-describe is a pytest plugin that lets you write tests using nested describe-blocks instead of flat test functions or test classes. Rather than naming each test to encode both the function being tested and the case (like `test_my_function_with_default_arguments`), you nest functions inside describe-blocks to create a hierarchy that mirrors your code structure. This reduces naming overhead and allows fixtures and marks to apply locally to groups of related tests.
The plugin works by recognizing functions prefixed with `describe_` (configurable) as test containers and collecting nested functions as individual tests. It supports pytest fixtures as describe-block arguments, shared behaviors similar to RSpec's shared examples, helper functions prefixed with underscore, and optional docstring-based naming for clearer test reports. It requires Python 3.10 or later and integrates transparently with pytest's standard collection and execution.
Use it for:
- Organizing tests for a class with multiple methods by creating nested describe-blocks for each method and cases within
- Sharing common test patterns across multiple test subjects using the behaves_like decorator
- Reducing test function name length and complexity by using describe hierarchy instead of long descriptive names
- Applying fixtures and marks to groups of related tests without repeating them in every test function
- Writing test suites that closely mirror the structure of the code being tested for easier navigation
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that organizes tests into nested describe-blocks, allowing test structure to mirror production code organization with separate cases for each function.
Yes. The plugin is actively maintained, has no known vulnerabilities, low install friction, and solves a real organizational problem for test suites. It's particularly valuable if your tests have multiple cases per function and you prefer hierarchy over long naming conventions. The MIT license imposes no restrictions.
Install
pytest-describe on PyPI
pip
pip install pytest-describeuv
uv add pytest-describepoetry
poetry add pytest-describeInstalling pytest-describe
Before you install
Low friction: pure Python wheel with only pytest as a runtime dependency. Actively maintained with a recent release 63 days ago and steady repository activity.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and proprietary projects with minimal restrictions.
Quickstart
pip install pytest-describe
import pytest
def describe_wallet():
def with_starting_balance():
@pytest.fixture
def wallet():
return Wallet(20)
def initial_amount(wallet):
assert wallet.balance == 20
Requires Python 3.10 or later
Verify before relying
- Whether shared behaviors (behaves_like) work correctly with all pytest fixture scopes and parametrization patterns
- Performance impact of nested describe-blocks on test collection time for large test suites
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pytest |
| Maintenance | actively maintained — 63 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,170,995/month — #4,270 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_describe-3.2.0-py3-none-any.whl
Keywords: test, unittest, plugin, describe
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
pytest-markdown-docsA pytest plugin that executes Python code…
permissive · top 15,000 on PyPI
pytest-integrationA pytest plugin that organizes tests into unit,…
permissive · top 15,000 on PyPI
pytest-casespytest-cases lets you separate test case data…
permissive · top 5,000 on PyPI
pytest-lazy-fixturesAllows you to reference pytest fixtures…
permissive · top 5,000 on PyPI
pytest-datadirA pytest plugin that provides fixtures for…
permissive · top 5,000 on PyPI
pytest-containerA pytest plugin that automates container…
copyleft · top 15,000 on PyPI
pytest-beartype-testsA pytest plugin that automatically applies…
permissive · top 15,000 on PyPI
pytest-codeblocksA pytest plugin that automatically discovers…
permissive · top 15,000 on PyPI
pytest-dockerpytest-docker provides pytest fixtures that…
permissive · top 5,000 on PyPI