Skip to main content

pytest-jira-xfail

Plugin skips (xfail) tests linked to unresolved Jira issue(s)

1. Generate your Jira API token

You should have Jira user with API token generated

2. Add PytestJiraHelper to your pytest hook:

import pytest

from pytest_jira_xfail.jira_helper import PytestJiraHelper


@pytest.hookimpl(tryfirst=True)
def pytest_collection_modifyitems(items):
    jira = PytestJiraHelper(
        jira_url="https://company.atlassian.net",
        jira_username="my_jira_user@company.com",
        jira_api_token="my_jira_user_api_token",
    )
    jira.process_linked_jira_issues(items)
from pytest_jira_xfail.annotations import bug


@bug("MP-123")
def test_my_test_fails():
    assert False


@bug("MP-124", IndexError)
def test_my_test_broken():
    db_records = []
    assert db_records[0]


@bug("MP-124")
@bug("MP-124", IndexError)
def test_multiple_exceptions():
    db_records = []
    assert db_records[0][0] == 'active'

XFAIL message format:

XFAIL The test is skipped because of open bugs:
https://company.atlassian.net/browse/MP-123

4. [Optional] Set custom resolved statuses

By default, only issues with the status "Done" and "Closed" are considered as resolved.
But you can override this and add more statuses, as following:

import pytest

from pytest_jira_xfail.jira_helper import PytestJiraHelper


@pytest.hookimpl(tryfirst=True)
def pytest_collection_modifyitems(items):
    jira = PytestJiraHelper(
        jira_url="https://company.atlassian.net",
        jira_username="my_jira_user@company.com",
        jira_api_token="my_jira_user_api_token",
        resolved_statuses=["Done", "Closed", "Released", "Declined"]
    )
    jira.process_linked_jira_issues(items)

Metadata

Release files for pytest-jira-xfail 1.0.2

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-jira-xfail 1.0.2
File Size Uploaded Provenance Actions
pytest-jira-xfail-1.0.2.tar.gz 4.2 kB Without provenance Details for pytest-jira-xfail-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-jira-xfail 1.0.2
File Interpreter ABI Platform Actions
pytest_jira_xfail-1.0.2-py3-none-any.whl Python 3 none any Details for pytest_jira_xfail-1.0.2-py3-none-any.whl

Total release size: 9.3 kB

Release files / pytest-jira-xfail-1.0.2.tar.gz

Download URL pytest-jira-xfail-1.0.2.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
401a43ddaf2e5baf4158dcafb5cf940642a71d3534bd87a0fbc90d620a79cc56
BLAKE2b-256 checksum
How to use checksums
159b2acb786c44e85e30c67577c6abb05a3f1afb0bb2abb6b8aa264b4683b181
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / pytest_jira_xfail-1.0.2-py3-none-any.whl

Download URL pytest_jira_xfail-1.0.2-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09e1b9fc7cf303e641dc4c7f908e9bab0ea78a052432a21c78b507d992435eeb
BLAKE2b-256 checksum
How to use checksums
9d16671e1c384ee0b1228a58da9f945e64ee47b474a7e6712709d684057f2993
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Security for pytest-jira-xfail 1.0.2

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.

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