Name | pytest-spec JSON |
Version |
4.0.0
JSON |
| download |
home_page | None |
Summary | Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION. |
upload_time | 2024-08-04 20:21:12 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | GPL-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.8/green">
<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">
</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/3.9.3/purple">
<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.2.2/purple">
</p>
<p align="center">
Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.
</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
### 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.
### 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}"
```
### 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 = "✓"
```
### 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 = "✗"
```
### 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 = "»"
```
### 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"
```
### 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 = " "
```
## 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
pip install -e .
```
### From source for testing
```sh
cd pytest-spec
pip install -e ".[test]"
```
### From source for build or deployment
```sh
cd pytest-spec
pip install -e ".[deploy]"
```
## 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)
## License
pytest-spec - pytest plugin to display test execution output like a SPECIFICATION.
Copyright (C) 2014-2024 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.8",
"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/79/45/ae0b948e4c0779e8a07b622bf7ac015dbdbf0cbdf2271b4dec79e8e7aa06/pytest_spec-4.0.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.8/green\">\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 </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/3.9.3/purple\">\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.2.2/purple\">\n </p>\n <p align=\"center\">\n Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.\n </p>\n</p>\n\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\n## Output example\n\n![Example](https://github.com/pchomik/pytest-spec/raw/master/docs/output.gif)\n\n\n## Configuration\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\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### 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* 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### 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### 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### 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### 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### 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## Continuous Integration\n\n[![Tests](https://github.com/pchomik/pytest-spec/workflows/test/badge.svg)](https://github.com/pchomik/pytest-spec/actions)\n\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 pip install -e .\n```\n\n### From source for testing\n\n```sh\n cd pytest-spec\n pip install -e \".[test]\"\n```\n\n### From source for build or deployment\n\n```sh\n cd pytest-spec\n pip install -e \".[deploy]\"\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\n\n## License\n\npytest-spec - pytest plugin to display test execution output like a SPECIFICATION.\n\nCopyright (C) 2014-2024 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": "4.0.0",
"project_urls": {
"Changelog": "https://github.com/pchomik/pytest-spec/CHANGES.txt",
"Documentation": "https://github.com/pchomik/pytest-spec",
"Issues": "https://github.com/pchomik/pytest-spec/issues",
"Repository": "https://github.com/pchomik/pytest-spec"
},
"split_keywords": [
"pytest",
" test",
" unittest",
" spec"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e1625855ce49868dde9a7c1cce1adfa12152c5d249a702a51a63af0510b75a08",
"md5": "041ead9c58e4db930b3de37a910e1edc",
"sha256": "5d85ed29d9240722dfe778bed80022b917154c8200020864a61bfa65f138f70a"
},
"downloads": -1,
"filename": "pytest_spec-4.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "041ead9c58e4db930b3de37a910e1edc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 14317,
"upload_time": "2024-08-04T20:21:11",
"upload_time_iso_8601": "2024-08-04T20:21:11.571088Z",
"url": "https://files.pythonhosted.org/packages/e1/62/5855ce49868dde9a7c1cce1adfa12152c5d249a702a51a63af0510b75a08/pytest_spec-4.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7945ae0b948e4c0779e8a07b622bf7ac015dbdbf0cbdf2271b4dec79e8e7aa06",
"md5": "ec0cf6bf9ec99b9970d74294d86fd3aa",
"sha256": "71c9985e97d090a69b1f1b7adb64e7a208fb1ac42432ce9566c32cdd6b44c1ad"
},
"downloads": -1,
"filename": "pytest_spec-4.0.0.tar.gz",
"has_sig": false,
"md5_digest": "ec0cf6bf9ec99b9970d74294d86fd3aa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 1192093,
"upload_time": "2024-08-04T20:21:12",
"upload_time_iso_8601": "2024-08-04T20:21:12.743659Z",
"url": "https://files.pythonhosted.org/packages/79/45/ae0b948e4c0779e8a07b622bf7ac015dbdbf0cbdf2271b4dec79e8e7aa06/pytest_spec-4.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-04 20:21:12",
"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"
}