pytest-spec
Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.
What it is and what it does
pytest-spec is a pytest plugin that changes how test results are displayed in the terminal. Instead of the default pytest output, it formats results to resemble a specification document, grouping tests by file and class, replacing underscores and test_ prefixes with readable names, and marking pass/fail/skip status with configurable indicators and colors.
The plugin is designed for teams that want test output to double as living documentation. It supports function-based, class-based, and describe-style tests, and allows extensive customization through pytest configuration files (pytest.ini or pyproject.toml) to control header format, test name display, status indicators, indentation, and filtering of unwanted output.
Use it for:
- Display test results as readable specification output during development and CI/CD pipelines.
- Replace test_ prefixes and underscores with human-readable names automatically in test output.
- Group and organize test results hierarchically by module, class, and describe blocks.
- Customize test result indicators (✓, ✗, ») and formatting to match team documentation standards.
- Filter out noise from other pytest plugins (e.g., FLAKE8, ISORT) in spec output.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pytest-spec is a pytest plugin that reformats test output to display results in a specification-like format with hierarchical grouping, colored status indicators, and human-readable test names.
Yes. Low install friction, no dependencies, actively maintained, supports modern Python versions, and zero known vulnerabilities. The GPL-2.0-or-later license is the only consideration—verify compatibility with your project's licensing before adopting. Useful for teams that want test output to serve as readable documentation.
Install
pytest-spec on PyPI
pip
pip install pytest-specuv
uv add pytest-specpoetry
poetry add pytest-specInstalling pytest-spec
Before you install
Low install friction with no runtime dependencies. The package is actively maintained with a recent release (89 days ago) and supports current Python versions (3.9 through 3.14).
License in practice
Licensed under GPL-2.0-or-later (copyleft). Any derivative work or distribution must comply with GPL-2.0 terms; review your project's license compatibility before adopting.
Quickstart
pip install pytest-spec
Then run pytest normally:
pytest
Optionally configure in pytest.ini or pyproject.toml:
[tool.pytest.ini_options]
spec_header_format = "{module_path}:"
spec_test_format = "{result} {name}"
Requires Python 3.9 or later. pytest must be installed and your tests must be discoverable by pytest.
Verify before relying
- Whether the plugin works with all pytest plugins or has known incompatibilities.
- Performance impact on test suites with many tests or complex hierarchies.
Package facts
| License | GPL-2.0-or-later (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 89 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 212,637/month — #9,452 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_spec-6.1.0-py3-none-any.whl
Keywords: pytest, test, unittest, spec
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-pspecFormats pytest test output in RSpec-style…
permissive · top 15,000 on PyPI
pytest-custom-reportA pytest plugin that lets you customize the…
permissive · top 15,000 on PyPI
pytest-pytestrailA pytest plugin that decorates test functions…
permissive · top 15,000 on PyPI
pytest-run-parallelA pytest plugin that runs test functions…
permissive · top 15,000 on PyPI
pytest-reverseA pytest plugin that runs tests in reverse…
permissive · top 15,000 on PyPI
tdd-guard-pytestA pytest plugin that captures test results and…
permissive · top 15,000 on PyPI
pytest-reporterA pytest plugin that generates customizable…
permissive · top 15,000 on PyPI
pytest-socketA pytest plugin that blocks or restricts socket…
permissive · top 5,000 on PyPI
pytest-opentelemetryA pytest plugin that instruments test runs with…
permissive · top 5,000 on PyPI
pytest-describeA pytest plugin that organizes tests into…
permissive · top 5,000 on PyPI