Skip to main content

pytest-spec

Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.

Available features

  • Format output to look like specification.
  • Group tests by classes and files
  • Failed, passed and skipped are marked and colored.
  • Remove test_ and underscores for every test.
  • It is possible to use docstring summary instead of test name.
  • Supports function based, class based test.
  • Supports describe like tests.

Output example

Example

Configuration

spec_header_format

You can configure the format of the test headers by specifying a format string in your ini-file:

    [tool:pytest]
    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.

spec_test_format

You can configure the format of the test results by specifying a format string in your ini-file:

3 variables are available:

  • result - place for indicator
  • name - name of test
  • docstring_summary - first line from test docstring if available
    [tool:pytest]
    spec_test_format = {result} {name}

or

    [tool:pytest]
    spec_test_format = {result} {docstring_summary}

In second example where docstring is not available the name will be added to spec output.

spec_success_indicator

You can configure the indicator displayed when test passed.

    [tool:pytest]
    spec_success_indicator = ✓

spec_failure_indicator

You can configure the indicator displated when test failed.

    [tool:pytest]
    spec_failure_indicator = ✗

spec_skipped_indicator

You can configure the indicator displated when test is skipped.

    [tool:pytest]
    spec_skipped_indicator = ?

spec_ignore

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.

    [tool:pytest]
    spec_ignore = FLAKE8

spec_indent

    [tool:pytest]
    spec_indent = "   "

Continuous Integration

Tests

Download

All versions of library are available on official pypi server.

Install

    pip install pytest-spec

Contribution

Please feel free to present your idea by code example (pull request) or reported issues.

Contributors

License

pytest-spec - pytest plugin to display test execution output like a SPECIFICATION.

Copyright (C) 2014-2021 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.

Metadata

Release files for pytest-spec 3.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-spec 3.2.0
File Size Uploaded Provenance Actions
pytest-spec-3.2.0.tar.gz 17.0 kB Without provenance Details for pytest-spec-3.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-spec 3.2.0
File Interpreter ABI Platform Actions
pytest_spec-3.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for pytest_spec-3.2.0-py2.py3-none-any.whl

Total release size: 37.7 kB

Release files / pytest-spec-3.2.0.tar.gz

Download URL pytest-spec-3.2.0.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4af154588195f4bb6c62d6ca030a20218db7d80b675a08897d9a99239ea3d087
BLAKE2b-256 checksum
How to use checksums
ea9f61c27fbad6cddc593405b072a726ff67c43c4802a54ddb22ffbcb1c25ae5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pytest_spec-3.2.0-py2.py3-none-any.whl

Download URL pytest_spec-3.2.0-py2.py3-none-any.whl
Size 20.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
128dd1e133c72d6a18b28ed96d0af0fc43aece8f796ebcfcd81c850f0094b62e
BLAKE2b-256 checksum
How to use checksums
f099ccc8061043646dd178052e17a6f3ba3c392024694a8a84f2462045745bc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Security for pytest-spec 3.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page