pytest-bug
Pytest plugin for marking tests as a bug
Installation
pip install pytest-bug
Example
import pytest
@pytest.mark.bug("C18", "Critical bug") # mark skip test
def test_one():
assert False
@pytest.mark.bug("C39", "Minor bug", run=True) # mark xfail test if fail else pass
def test_two():
assert False
@pytest.mark.bug("C41", "Minor bug", run=True)
def test_three():
assert True
@pytest.mark.bug("Bug all tests")
class TestFour:
def test_one(self): # mark skip test
assert False
def test_two(self): # mark skip test
assert True
@pytest.mark.bug("Unstable tests", run=True)
class TestFive:
def test_one(self): # mark xfail
assert False
def test_two(self): # pass
assert True
$ pytest
======================== test session starts ========================
platform linux -- Python 3.x.y, pytest-x.y.z, py-x.y.z, pluggy-x.y.z
cachedir: $PYTHON_PREFIX/.pytest_cache
rootdir: $REGENDOC_TMPDIR
plugins: bug-x.y.z
collected 7 items
test_sample.py bfpbbfp
---------- Bugs skipped: 3 Bugs passed: 2 Bugs failed: 2 ----------
=================== 2 passed, 5 skipped in 0.10s ===================
Symbols:
b- bug skipf- bug failp- bug pass
verbosity
$ pytest -v
======================== test session starts ========================
platform linux -- Python 3.x.y, pytest-x.y.z, py-x.y.z, pluggy-x.y.z
cachedir: $PYTHON_PREFIX/.pytest_cache
rootdir: $REGENDOC_TMPDIR
plugins: bug-x.y.z
collected 7 items
test_sample.py::test_one BUG-SKIP [ 14%]
test_sample.py::test_two BUG-FAIL [ 28%]
test_sample.py::test_three BUG-PASS [ 42%]
test_sample.py::TestFour::test_one BUG-SKIP [ 57%]
test_sample.py::TestFour::test_two BUG-SKIP [ 71%]
test_sample.py::TestFive::test_one BUG-FAIL [ 85%]
test_sample.py::TestFive::test_two BUG-PASS [100%]
---------- Bugs skipped: 3 Bugs passed: 2 Bugs failed: 2 ----------
=================== 2 passed, 5 skipped in 0.10s ===================
Options:
| option | description | config |
|---|---|---|
| --bug-no-stats | Disabling summary statistics | bug_summary_stats (bool) |
| --bug-pattern=REGEX | Run matching tests marked as bug | - |
| --bug-all-run | Includes all bugs in the run | - |
| --bug-all-skip | Disables all bugs in the run | - |
| --bug-skip-letter=LETTER | Set to output in console for skip-bug (default: b) | bug_skip_letter (string) |
| --bug-fail-letter=LETTER | Set to output in console for fail-bug (default: f) | bug_fail_letter (string) |
| --bug-pass-letter=LETTER | Set to output in console for pass-bug (default: p) | bug_pass_letter (string) |
| --bug-skip-word=WORLD | Set to output in console for skip-bug verbosity (default: BUG-SKIP) | bug_skip_word (string) |
| --bug-fail-word=WORLD | Set to output in console for fail-bug verbosity (default: BUG-FAIL) | bug_fail_word (string) |
| --bug-pass-word=WORLD | Set to output in console for fail-bug verbosity (default: BUG-PASS) | bug_pass_word (string) |
pytest-xdist
The plugin works with pytest-xdist: reports of marked tests are passed from workers to the controller, so the symbols, verbosity words and summary statistics are the same as in a single-process run.
Contributions are very welcome.
Getting started
- python 3.10+
- uv
- Clone the repository
git clone https://github.com/tolstislon/pytest-bug.git cd pytest-bug
- Install dev dependencies
uv sync - Run ruff format
uv run ruff format
- Run ruff check
uv run ruff check --fix
- Run the tests
uv run coverage run --source=./pytest_bug -m pytest ./tests && uv run coverage report -m
Metadata
Release files for pytest-bug 1.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest_bug-1.7.0.tar.gz | 36.6 kB | Without provenance | Details for pytest_bug-1.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_bug-1.7.0-py3-none-any.whl | Python 3 | none | any | Details for pytest_bug-1.7.0-py3-none-any.whl |
Total release size: 44.8 kB
Release files / pytest_bug-1.7.0.tar.gz
| Download URL | pytest_bug-1.7.0.tar.gz |
|---|---|
| Size | 36.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
abd808becacbdbb8e1081f27020244c66be1d160e1d6823056fef1e27198f761
|
|
BLAKE2b-256 checksum How to use checksums |
bd7aa35645d12650981073f21682686db597e68d2fd5043043c98511547d3d5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / pytest_bug-1.7.0-py3-none-any.whl
| Download URL | pytest_bug-1.7.0-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3611ad845b6e687ac60b9d877ae96645cab81241234b64405f553d041b57020
|
|
BLAKE2b-256 checksum How to use checksums |
f8d3ae239df64c53ef3cdc1567910634f8bbe1114ce10dabcbc410109345372c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for pytest-bug 1.7.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.