skillfed

pytest-describe

Describe-style plugin for pytest

pytest-describe v3.2.0 1.2M downloads/30d#4,270 on PyPI238
Permissive license MIT Active released

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-describe

uv

uv add pytest-describe

poetry

poetry add pytest-describe

Installing 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

Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: LibrariesTopic :: Software Development :: TestingTopic :: UtilitiesTyping :: Typed

Tags

pytest nested describe blocksrspec style testing pythonorganize tests by function casespytest describe pluginhierarchical test organizationjasmine style test structuretest grouping and nesting
test-organizationrspec-stylepytest-plugin

More Libraries packages