
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.
Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.
[Documentation]
You can configure the format of the test headers by specifying a format string in your ini-file:
; since pytest 4.6.x
[pytest]
spec_header_format = {module_path}:
; legacy pytest
[tool:pytest]
spec_header_format = {module_path}:
or in your pyproject.toml file:
[tool.pytest.ini_options]
spec_header_format = "{module_path}:"
In addition to the {path}
and {class_name}
replacement fields, there is also {test_case}
that holds a more human readable name.
You can configure the format of the test results by specifying a format string in your ini-file:
3 variables are available:
; since pytest 4.6.x
[pytest]
spec_test_format = {result} {name}
; legacy pytest
[tool:pytest]
spec_test_format = {result} {name}
or
; since pytest 4.6.x
[pytest]
spec_test_format = {result} {docstring_summary}
; legacy pytest
[tool:pytest]
spec_test_format = {result} {docstring_summary}
In second example where docstring is not available the name will be added to spec output.
Similar configuration could be done in your pyproject.toml file:
[tool.pytest.ini_options]
spec_test_format = "{result} {name}"
or
[tool.pytest.ini_options]
spec_test_format = "{result} {docstring_summary}"
You can configure the indicator displayed when test passed.
ini-file
; since pytest 4.6.x
[pytest]
spec_success_indicator = ✓
; legacy pytest
[tool:pytest]
spec_success_indicator = ✓
or pyproject.toml
[tool.pytest.ini_options]
spec_success_indicator = "✓"
You can configure the indicator displated when test failed.
ini-file
; since pytest 4.6.x
[pytest]
spec_failure_indicator = ✗
; legacy pytest
[tool:pytest]
spec_failure_indicator = ✗
or pyproject.toml
[tool.pytest.ini_options]
spec_failure_indicator = "✗"
You can configure the indicator displated when test is skipped.
ini-file
; since pytest 4.6.x
[pytest]
spec_skipped_indicator = »
; legacy pytest
[tool:pytest]
spec_skipped_indicator = »
or pyproject.toml
[tool.pytest.ini_options]
spec_skipped_indicator = "»"
Comma-separated settings to ignore/hide some tests or output from from plugins like FLAKE8 or ISORT. Any test which contain provided string will be ignored in output spec.
ini-file
; since pytest 4.6.x
[pytest]
spec_ignore = FLAKE8
; legacy pytest
[tool:pytest]
spec_ignore = FLAKE8
or pyproject.toml
[tool.pytest.ini_options]
spec_ignore = "FLAKE8"
ini-file
; since pytest 4.6.x
[pytest]
spec_indent = " "
; legacy pytest
[tool:pytest]
spec_indent = " "
or pyproject.toml
[tool.pytest.ini_options]
spec_indent = " "
All versions of library are available on official pypi server.
pip install pytest-spec
cd pytest-spec
uv sync
cd pytest-spec
uv sync --all-extras --dev
cd pytest-spec
uv sync
uv build
uv publish
Please feel free to present your idea by code example (pull request) or reported issues.
pytest-spec - pytest plugin to display test execution output like a SPECIFICATION.
Copyright (C) 2014-2025 Pawel Chomicki
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
FAQs
Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.
We found that pytest-spec demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.