pytest-spec


Namepytest-spec JSON
Version 5.1.0 PyPI version JSON
download
home_pageNone
SummaryLibrary pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.
upload_time2025-09-08 18:07:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseGPL-2.0-or-later
keywords pytest test unittest spec
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p>
    <h1 align="center">pytest-spec</h1>
    <p align="center">
        <img src="https://badgen.net/badge/python/3.9/green">
        <img src="https://badgen.net/badge/python/3.10/green">
        <img src="https://badgen.net/badge/python/3.11/green">
        <img src="https://badgen.net/badge/python/3.12/green">
        <img src="https://badgen.net/badge/python/3.13/green">
    </p>
    <p align="center">
        <img src="https://badgen.net/badge/os/linux/blue">
        <img src="https://badgen.net/badge/os/windows/blue">
        <img src="https://badgen.net/badge/os/macos/blue">
    </p>
    <p align="center">
        <img src="https://badgen.net/badge/pytest/4.6.11/purple">
        <img src="https://badgen.net/badge/pytest/5.4.3/purple">
        <img src="https://badgen.net/badge/pytest/6.2.5/purple">
        <img src="https://badgen.net/badge/pytest/7.4.4/purple">
        <img src="https://badgen.net/badge/pytest/8.4.0/purple">
    </p>
    <p align="center">
        Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION. <br>
        <a href="https://pchomik.ovh/docs/pytest-spec/about" target="_blank" rel="noopener noreferrer">[Documentation]</a>
    </p>
</p>

## 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](https://github.com/pchomik/pytest-spec/raw/master/docs/output.gif)

## Configuration

<details>

<summary>spec_header_format</summary>

### spec_header_format

You can configure the format of the test headers by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](https://docs.pytest.org/en/stable/customize.html#pytest-ini):

```ini
    ; 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](https://docs.pytest.org/en/stable/reference/customize.html#pyproject-toml) file:

```toml
    [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.

</details>

<details>

<summary>spec_test_format</summary>

### spec_test_format

You can configure the format of the test results by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](https://docs.pytest.org/en/stable/customize.html#pytest-ini):

3 variables are available:

-   result - place for indicator
-   name - name of test
-   docstring_summary - first line from test docstring if available

```ini
    ; since pytest 4.6.x
    [pytest]
    spec_test_format = {result} {name}

    ; legacy pytest
    [tool:pytest]
    spec_test_format = {result} {name}
```

or

```ini
    ; 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](https://docs.pytest.org/en/stable/reference/customize.html#pyproject-toml) file:

```toml
    [tool.pytest.ini_options]
    spec_test_format = "{result} {name}"
```

or

```toml
    [tool.pytest.ini_options]
    spec_test_format = "{result} {docstring_summary}"
```

</details>

<details>

<summary>spec_success_indicator</summary>

### spec_success_indicator

You can configure the indicator displayed when test passed.

_ini-file_

```ini
    ; since pytest 4.6.x
    [pytest]
    spec_success_indicator = ✓

    ; legacy pytest
    [tool:pytest]
    spec_success_indicator = ✓
```

_or pyproject.toml_

```toml
    [tool.pytest.ini_options]
    spec_success_indicator = "✓"
```

</details>

<details>

<summary>spec_failure_indicator</summary>

### spec_failure_indicator

You can configure the indicator displated when test failed.

_ini-file_

```ini
    ; since pytest 4.6.x
    [pytest]
    spec_failure_indicator = ✗

    ; legacy pytest
    [tool:pytest]
    spec_failure_indicator = ✗
```

or _pyproject.toml_

```toml
    [tool.pytest.ini_options]
    spec_failure_indicator = "✗"
```

</details>

<details>

<summary>spec_skipped_indicator</summary>

### spec_skipped_indicator

You can configure the indicator displated when test is skipped.

_ini-file_

```ini
    ; since pytest 4.6.x
    [pytest]
    spec_skipped_indicator = »

    ; legacy pytest
    [tool:pytest]
    spec_skipped_indicator = »
```

or _pyproject.toml_

```toml
    [tool.pytest.ini_options]
    spec_skipped_indicator = "»"
```

</details>

<details>

<summary>spec_ignore</summary>

### 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.

_ini-file_

```ini
    ; since pytest 4.6.x
    [pytest]
    spec_ignore = FLAKE8

    ; legacy pytest
    [tool:pytest]
    spec_ignore = FLAKE8
```

or _pyproject.toml_

```toml
    [tool.pytest.ini_options]
    spec_ignore = "FLAKE8"
```

</details>

<details>

<summary>spec_indent</summary>

### spec_indent

_ini-file_

```ini
    ; since pytest 4.6.x
    [pytest]
    spec_indent = "   "

    ; legacy pytest
    [tool:pytest]
    spec_indent = "   "
```

or _pyproject.toml_

```toml
    [tool.pytest.ini_options]
    spec_indent = "   "
```

</details>

## Continuous Integration

[![Tests](https://github.com/pchomik/pytest-spec/workflows/test/badge.svg)](https://github.com/pchomik/pytest-spec/actions)

## Download

All versions of library are available on official [pypi server](https://pypi.org/project/pytest-spec/#history).

## Install

### From [pypi.org](https://pypi.org)

```sh
    pip install pytest-spec
```

### From source

```sh
    cd pytest-spec
    uv sync
```

### From source for testing

```sh
    cd pytest-spec
    uv sync --all-extras --dev
```

### From source for build or deployment

```sh
    cd pytest-spec
    uv sync
    uv build
    uv publish
```

## Contribution

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

## Contributors

-   [@0x64746b](https://github.com/0x64746b)
-   [@lucasmarshall](https://github.com/lucasmarshall)
-   [@amcgregor](https://github.com/amcgregor)
-   [@jhermann](https://github.com/jhermann)
-   [@frenzymadness](https://github.com/frenzymadness)
-   [@chrischambers](https://github.com/chrischambers)
-   [@maxalbert](https://github.com/maxalbert)
-   [@jayvdb](https://github.com/jayvdb)
-   [@hugovk](https://github.com/hugovk)
-   [@b0g3r](https://github.com/b0g3r)
-   [@paxcodes](https://github.com/paxcodes)
-   [@s-t-e-v-e-n-k](https://github.com/s-t-e-v-e-n-k)
-   [@yk-kd](https://github.com/yk-kd)

## License

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.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pytest-spec",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "pytest, test, unittest, spec",
    "author": null,
    "author_email": "Pawel Chomicki <pawel.chomicki@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3e/1c/5e03ff220b4ef73fb07eb525a2bbf5d804d73bf291e1cdc0ed1f2450f1db/pytest_spec-5.1.0.tar.gz",
    "platform": null,
    "description": "<p>\n    <h1 align=\"center\">pytest-spec</h1>\n    <p align=\"center\">\n        <img src=\"https://badgen.net/badge/python/3.9/green\">\n        <img src=\"https://badgen.net/badge/python/3.10/green\">\n        <img src=\"https://badgen.net/badge/python/3.11/green\">\n        <img src=\"https://badgen.net/badge/python/3.12/green\">\n        <img src=\"https://badgen.net/badge/python/3.13/green\">\n    </p>\n    <p align=\"center\">\n        <img src=\"https://badgen.net/badge/os/linux/blue\">\n        <img src=\"https://badgen.net/badge/os/windows/blue\">\n        <img src=\"https://badgen.net/badge/os/macos/blue\">\n    </p>\n    <p align=\"center\">\n        <img src=\"https://badgen.net/badge/pytest/4.6.11/purple\">\n        <img src=\"https://badgen.net/badge/pytest/5.4.3/purple\">\n        <img src=\"https://badgen.net/badge/pytest/6.2.5/purple\">\n        <img src=\"https://badgen.net/badge/pytest/7.4.4/purple\">\n        <img src=\"https://badgen.net/badge/pytest/8.4.0/purple\">\n    </p>\n    <p align=\"center\">\n        Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION. <br>\n        <a href=\"https://pchomik.ovh/docs/pytest-spec/about\" target=\"_blank\" rel=\"noopener noreferrer\">[Documentation]</a>\n    </p>\n</p>\n\n## Available features\n\n-   Format output to look like specification.\n-   Group tests by classes and files\n-   Failed, passed and skipped are marked and colored.\n-   Remove test\\_ and underscores for every test.\n-   It is possible to use docstring summary instead of test name.\n-   Supports function based, class based test.\n-   Supports describe like tests.\n\n## Output example\n\n![Example](https://github.com/pchomik/pytest-spec/raw/master/docs/output.gif)\n\n## Configuration\n\n<details>\n\n<summary>spec_header_format</summary>\n\n### spec_header_format\n\nYou can configure the format of the test headers by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](https://docs.pytest.org/en/stable/customize.html#pytest-ini):\n\n```ini\n    ; since pytest 4.6.x\n    [pytest]\n    spec_header_format = {module_path}:\n\n    ; legacy pytest\n    [tool:pytest]\n    spec_header_format = {module_path}:\n```\n\nor in your [pyproject.toml](https://docs.pytest.org/en/stable/reference/customize.html#pyproject-toml) file:\n\n```toml\n    [tool.pytest.ini_options]\n    spec_header_format = \"{module_path}:\"\n```\n\nIn addition to the `{path}` and `{class_name}` replacement fields, there is also `{test_case}` that holds a more human readable name.\n\n</details>\n\n<details>\n\n<summary>spec_test_format</summary>\n\n### spec_test_format\n\nYou can configure the format of the test results by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](https://docs.pytest.org/en/stable/customize.html#pytest-ini):\n\n3 variables are available:\n\n-   result - place for indicator\n-   name - name of test\n-   docstring_summary - first line from test docstring if available\n\n```ini\n    ; since pytest 4.6.x\n    [pytest]\n    spec_test_format = {result} {name}\n\n    ; legacy pytest\n    [tool:pytest]\n    spec_test_format = {result} {name}\n```\n\nor\n\n```ini\n    ; since pytest 4.6.x\n    [pytest]\n    spec_test_format = {result} {docstring_summary}\n\n    ; legacy pytest\n    [tool:pytest]\n    spec_test_format = {result} {docstring_summary}\n```\n\nIn second example where docstring is not available the name will be added to spec output.\n\nSimilar configuration could be done in your [pyproject.toml](https://docs.pytest.org/en/stable/reference/customize.html#pyproject-toml) file:\n\n```toml\n    [tool.pytest.ini_options]\n    spec_test_format = \"{result} {name}\"\n```\n\nor\n\n```toml\n    [tool.pytest.ini_options]\n    spec_test_format = \"{result} {docstring_summary}\"\n```\n\n</details>\n\n<details>\n\n<summary>spec_success_indicator</summary>\n\n### spec_success_indicator\n\nYou can configure the indicator displayed when test passed.\n\n_ini-file_\n\n```ini\n    ; since pytest 4.6.x\n    [pytest]\n    spec_success_indicator = \u2713\n\n    ; legacy pytest\n    [tool:pytest]\n    spec_success_indicator = \u2713\n```\n\n_or pyproject.toml_\n\n```toml\n    [tool.pytest.ini_options]\n    spec_success_indicator = \"\u2713\"\n```\n\n</details>\n\n<details>\n\n<summary>spec_failure_indicator</summary>\n\n### spec_failure_indicator\n\nYou can configure the indicator displated when test failed.\n\n_ini-file_\n\n```ini\n    ; since pytest 4.6.x\n    [pytest]\n    spec_failure_indicator = \u2717\n\n    ; legacy pytest\n    [tool:pytest]\n    spec_failure_indicator = \u2717\n```\n\nor _pyproject.toml_\n\n```toml\n    [tool.pytest.ini_options]\n    spec_failure_indicator = \"\u2717\"\n```\n\n</details>\n\n<details>\n\n<summary>spec_skipped_indicator</summary>\n\n### spec_skipped_indicator\n\nYou can configure the indicator displated when test is skipped.\n\n_ini-file_\n\n```ini\n    ; since pytest 4.6.x\n    [pytest]\n    spec_skipped_indicator = \u00bb\n\n    ; legacy pytest\n    [tool:pytest]\n    spec_skipped_indicator = \u00bb\n```\n\nor _pyproject.toml_\n\n```toml\n    [tool.pytest.ini_options]\n    spec_skipped_indicator = \"\u00bb\"\n```\n\n</details>\n\n<details>\n\n<summary>spec_ignore</summary>\n\n### spec_ignore\n\nComma-separated settings to ignore/hide some tests or output from from plugins like FLAKE8 or ISORT.\nAny test which contain provided string will be ignored in output spec.\n\n_ini-file_\n\n```ini\n    ; since pytest 4.6.x\n    [pytest]\n    spec_ignore = FLAKE8\n\n    ; legacy pytest\n    [tool:pytest]\n    spec_ignore = FLAKE8\n```\n\nor _pyproject.toml_\n\n```toml\n    [tool.pytest.ini_options]\n    spec_ignore = \"FLAKE8\"\n```\n\n</details>\n\n<details>\n\n<summary>spec_indent</summary>\n\n### spec_indent\n\n_ini-file_\n\n```ini\n    ; since pytest 4.6.x\n    [pytest]\n    spec_indent = \"   \"\n\n    ; legacy pytest\n    [tool:pytest]\n    spec_indent = \"   \"\n```\n\nor _pyproject.toml_\n\n```toml\n    [tool.pytest.ini_options]\n    spec_indent = \"   \"\n```\n\n</details>\n\n## Continuous Integration\n\n[![Tests](https://github.com/pchomik/pytest-spec/workflows/test/badge.svg)](https://github.com/pchomik/pytest-spec/actions)\n\n## Download\n\nAll versions of library are available on official [pypi server](https://pypi.org/project/pytest-spec/#history).\n\n## Install\n\n### From [pypi.org](https://pypi.org)\n\n```sh\n    pip install pytest-spec\n```\n\n### From source\n\n```sh\n    cd pytest-spec\n    uv sync\n```\n\n### From source for testing\n\n```sh\n    cd pytest-spec\n    uv sync --all-extras --dev\n```\n\n### From source for build or deployment\n\n```sh\n    cd pytest-spec\n    uv sync\n    uv build\n    uv publish\n```\n\n## Contribution\n\nPlease feel free to present your idea by code example (pull request) or reported issues.\n\n## Contributors\n\n-   [@0x64746b](https://github.com/0x64746b)\n-   [@lucasmarshall](https://github.com/lucasmarshall)\n-   [@amcgregor](https://github.com/amcgregor)\n-   [@jhermann](https://github.com/jhermann)\n-   [@frenzymadness](https://github.com/frenzymadness)\n-   [@chrischambers](https://github.com/chrischambers)\n-   [@maxalbert](https://github.com/maxalbert)\n-   [@jayvdb](https://github.com/jayvdb)\n-   [@hugovk](https://github.com/hugovk)\n-   [@b0g3r](https://github.com/b0g3r)\n-   [@paxcodes](https://github.com/paxcodes)\n-   [@s-t-e-v-e-n-k](https://github.com/s-t-e-v-e-n-k)\n-   [@yk-kd](https://github.com/yk-kd)\n\n## License\n\npytest-spec - pytest plugin to display test execution output like a SPECIFICATION.\n\nCopyright (C) 2014-2025 Pawel Chomicki\n\nThis 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.\n\nThis 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.\n",
    "bugtrack_url": null,
    "license": "GPL-2.0-or-later",
    "summary": "Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.",
    "version": "5.1.0",
    "project_urls": {
        "Changelog": "https://github.com/pchomik/pytest-spec/CHANGES.txt",
        "Documentation": "https://pchomik.ovh/docs/pytest-spec/about",
        "Issues": "https://github.com/pchomik/pytest-spec/issues",
        "Repository": "https://github.com/pchomik/pytest-spec"
    },
    "split_keywords": [
        "pytest",
        " test",
        " unittest",
        " spec"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0ab46832aa168573cce23f0177a94281b24324915d718dcd0b7685383f9c2c9b",
                "md5": "f6de29da77337ac4c28e4a7518dae4ff",
                "sha256": "363594b7d63421caf48e4ec6f4caa6d764fac1f56186c9d200173bc97f28fcab"
            },
            "downloads": -1,
            "filename": "pytest_spec-5.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f6de29da77337ac4c28e4a7518dae4ff",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 15126,
            "upload_time": "2025-09-08T18:07:02",
            "upload_time_iso_8601": "2025-09-08T18:07:02.443179Z",
            "url": "https://files.pythonhosted.org/packages/0a/b4/6832aa168573cce23f0177a94281b24324915d718dcd0b7685383f9c2c9b/pytest_spec-5.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3e1c5e03ff220b4ef73fb07eb525a2bbf5d804d73bf291e1cdc0ed1f2450f1db",
                "md5": "ac895488deb261fc9b6bda48dc5d41ea",
                "sha256": "841aef3d40b1be61351ade0b1bd8de25d74530670c55f4f95de8c6ebf3ea10cd"
            },
            "downloads": -1,
            "filename": "pytest_spec-5.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ac895488deb261fc9b6bda48dc5d41ea",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 1193372,
            "upload_time": "2025-09-08T18:07:04",
            "upload_time_iso_8601": "2025-09-08T18:07:04.139609Z",
            "url": "https://files.pythonhosted.org/packages/3e/1c/5e03ff220b4ef73fb07eb525a2bbf5d804d73bf291e1cdc0ed1f2450f1db/pytest_spec-5.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-08 18:07:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pchomik",
    "github_project": "pytest-spec",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pytest-spec"
}
        
Elapsed time: 3.86760s