Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-spec-3.2.0rc1.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_spec-3.2.0rc1-py2.py3-none-any.whl (20.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pytest-spec-3.2.0rc1.tar.gz.

File metadata

  • Download URL: pytest-spec-3.2.0rc1.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using 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.8.9

File hashes

Hashes for pytest-spec-3.2.0rc1.tar.gz
Algorithm Hash digest
SHA256 8791f00db44b0ad40802ea98a2bdb7c34ec6d8a3382b1c8407bd8e70b6193028
MD5 c70d55949601d566092899f51956d573
BLAKE2b-256 d5776b81a2e7c7b0192e8de47427f49a0613fd40500818c470efd6f7cfc14e60

See more details on using hashes here.

File details

Details for the file pytest_spec-3.2.0rc1-py2.py3-none-any.whl.

File metadata

  • Download URL: pytest_spec-3.2.0rc1-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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.8.9

File hashes

Hashes for pytest_spec-3.2.0rc1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f7744a84d62fec42aa497dabcaafa6cd54ae57aa87ac93b921665b1394160db9
MD5 5e3e3f53ab675b9c3fa44ad15acbca7c
BLAKE2b-256 d37f9cfbf9af27a4d0146a9a31c09c4a35a53a104bd3e3121caa0cb99f8e8fb4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page