Skip to main content

pytest-bug

PyPI Downloads PyPI - Python Version pytes_support Build Pypi

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 skip
  • f - bug fail
  • p - 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)

Contributions are very welcome.

Getting started
  • python 3.12
  • pipenv 2023.11.15+
  1. Clone the repository
    git clone https://github.com/tolstislon/pytest-bug.git
    cd pytest-bug
    
  2. Install dev dependencies
    pipenv install --dev
    pipenv shell
    
  3. Run ruff format
    pipenv run format
    
  4. Run ruff check
    pipenv run check
    
  5. Run the tests
    pipenv run tests
    

Metadata

Release files for pytest-bug 1.6.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-bug 1.6.0
File Size Uploaded
pytest_bug-1.6.0.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-bug 1.6.0
File Interpreter ABI Platform
pytest_bug-1.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.5 kB

Release files / pytest_bug-1.6.0.tar.gz

Download URL pytest_bug-1.6.0.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b3b6627bad835e6987ad036b16ce0e44998aa7f384a500431f8633a11a928e79
BLAKE2b-256 checksum
How to use checksums
b53125749e782ae6a272e536420f2c0bc01f654c63fb826a750a69b1e3b0ff87
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.6.0-py3-none-any.whl

Download URL pytest_bug-1.6.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5e5e763edf3addff77e7a2f466b703e42f9ee67c6857a1a9d04944ed697c408
BLAKE2b-256 checksum
How to use checksums
7f5afff886c66f31e55d4f6ce3217c6ce5dd9dd85e7e59b411ffbac413d0cb4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.8.0

1 release file

0.7.6

1 release file

0.7.5

1 release file

0.6.3

1 release file

0.5.6

1 release file

0.4.6

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.2

1 release file

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