Skip to main content

Pytest plugin for marking tests as a bug

Project description

pytest-bug

PyPI PyPI - Python Version pytes_support Downloads 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.11
  • pipenv 2022.12.19+
  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 the black
    pipenv run black
    
  4. Run the tests
    pipenv run tests
    

Project 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-bug-1.3.0.tar.gz (11.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_bug-1.3.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest-bug-1.3.0.tar.gz.

File metadata

  • Download URL: pytest-bug-1.3.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for pytest-bug-1.3.0.tar.gz
Algorithm Hash digest
SHA256 a78d2a3ac32499603441a3ebf63018cc897ed8faca5b1b74eec41d553ceacd94
MD5 1e0765d732b9608a2886c3de40c32414
BLAKE2b-256 c1955b06dda345579fcea09644ab1cf9990a803e88aa3397354019bee200f150

See more details on using hashes here.

File details

Details for the file pytest_bug-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_bug-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for pytest_bug-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd302bb0864d7a2258ed9370a5372464341b7802873efe08df604c5ab8ba8ee5
MD5 166936c7fc1242a80f5e35fe4e685a51
BLAKE2b-256 c8c47a23938ff04b86750a1ecd6fe4bf79fa011789d6e4e2d10ebd244f2e03a5

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 Pingdom Monitoring Sentry Error logging StatusPage Status page