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)
3. Link bugs to your tests
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)
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)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest-jira-xfail-1.0.2.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_jira_xfail-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
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
|