Skip to main content

py.test JIRA integration plugin, using markers

Project description

Build Status Code Health Code Coverage

Intro

A pytest plugin for JIRA integration.

This plugin links tests with JIRA tickets. The plugin behaves similar to the pytest-bugzilla plugin.

The plugin does not close JIRA tickets, or create them. It just allows you to link tests to existing tickets.

Please feel free to contribute by forking and submitting pull requests or by submitting feature requests or issues to issues.

Test results

  • If the test unresolved

    • and the run=False, the test is skiped

    • and the run=True or not set, the test is executed and based on it the result is xpassed (e.g. unexpected pass) or xfailed (e.g. expected fail)

  • If the test resolved

    • the test is executed and based on it the result is passed or failed

Marking tests

You can specify jira issue ID in docstring or in pytest.mark.jira decorator.

If you use decorator you can specify optional parameter run. If it’s false and issue is unresolved, the test will be skipped.

You can disable searching for issue ID in doc string by using --jira-disable-docs-search parameter or by docs_search=False in jira.cfg. It’s also possible to change behavior if issue ID was not found by setting --jira-marker-strategy=STRATEGY or in config file as marker_strategy=STRATEGY.

You can use one of following strategies:

  • open - issue is considered as open (default)

  • strict - raise an exception

  • ignore - issue id is ignored

  • warn - write error message and ignore

By default the regular expression patter for matching jira issue ID is [A-Z]+-[0-9]+, it can by changed by --jira-issue-regex=REGEX or in a config file by jira_regex=REGEX.

Example

@pytest.mark.jira("ORG-1382", run=False)
def test_skip(): # will be skipped if unresolved
    assert False

@pytest.mark.jira("ORG-1382")
def test_xfail(): # will run and xfail if unresolved
    assert False

def test_xpass(): # will run and xpass if unresolved
"""issue: ORG-1382"""
    assert True

Status evaluation

Issues are consider resolved if their status is “Resolved” or “Closed”. If you specify components (in command line or jira.cfg), open issues will be considered unresolved only if they are also open for at least one used component.

If you specify version, open issues will be unresolved only if they also affects your version. Even when the issue is closed, but your version was affected and it was not fixed for your version, the issue will be considered unresolved.

Requires

  • pytest >= 2.2.3

  • jira >= 0.43

  • six

Installation

pip install pytest_jira

Usage

  1. Create a jira.cfg in the root of your tests:

    [DEFAULT]
    url = https://jira.atlassian.com
    username = USERNAME (or blank for no authentication
    password = PASSWORD (or blank for no authentication)
    # ssl_verification = True/False
    # version = foo-1.0
    # components = com1,second component,com3
    # strategy = [open|strict|warn|ignore] (dealing with not found issues)
    # docs_search = False (disable searching for issue id in docs)
    # issue_regex = REGEX (replace default `[A-Z]+-[0-9]+` regular expression)

    Options can be overridden with command line options. The configuration file can also be placed in /etc/jira.cfg and ~/jira.cfg.

  2. Mark your tests with jira marker and issue id. @pytest.mark.jira('issue_id')

    You can put Jira ID into doc string of test case as well.

  3. Run py.test with jira option to enable the plugin. py.test --jira

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

pytest-jira-0.2.2.zip (24.7 kB view details)

Uploaded Source

pytest-jira-0.2.2.tar.gz (17.9 kB view details)

Uploaded Source

Built Distributions

pytest_jira-0.2.2-py2.7.egg (12.0 kB view details)

Uploaded Source

pytest-jira-0.2.2-1.src.rpm (30.4 kB view details)

Uploaded Source

pytest-jira-0.2.2-1.noarch.rpm (21.5 kB view details)

Uploaded Source

File details

Details for the file pytest-jira-0.2.2.zip.

File metadata

  • Download URL: pytest-jira-0.2.2.zip
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pytest-jira-0.2.2.zip
Algorithm Hash digest
SHA256 a62e187bf20d86111d546853d661bd6c1112d06efcc72c2afe40c87a9b6b0faf
MD5 2c5d9810d4e217144c47af8be6c5243a
BLAKE2b-256 e32e34f9d95156a141d71dd08d809e441b89577e4431380e9f7b7ac097b88791

See more details on using hashes here.

File details

Details for the file pytest-jira-0.2.2.tar.gz.

File metadata

  • Download URL: pytest-jira-0.2.2.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pytest-jira-0.2.2.tar.gz
Algorithm Hash digest
SHA256 9d7116b34ebc8803eca5107b45386e52f1804d9c5f91d8d5e114434b9ad7321c
MD5 a0e2c3b91621bf66c37b9a0f3409977c
BLAKE2b-256 82e8226315829c97c50c65367f86015fdaefbd6edc7a4373d29a7bbdbfd8af81

See more details on using hashes here.

File details

Details for the file pytest_jira-0.2.2-py2.7.egg.

File metadata

File hashes

Hashes for pytest_jira-0.2.2-py2.7.egg
Algorithm Hash digest
SHA256 fa2efeb1a0dffd0373e08fdba8fe8d5e747aabe93ab7f28f31b91ac91117934b
MD5 b585d206efb225a97c73efcfc1993c95
BLAKE2b-256 d2e4497ca9767d6e31021fff46aa17cfbbcbea515bc512d3cf3d0c2557ef6075

See more details on using hashes here.

File details

Details for the file pytest-jira-0.2.2-1.src.rpm.

File metadata

File hashes

Hashes for pytest-jira-0.2.2-1.src.rpm
Algorithm Hash digest
SHA256 dfd720c2667665cc9057f21b3e32ffa195290bc922c83e56b7bc80bd7114880e
MD5 e7187b76a81b647aaa963cdc22c41ee8
BLAKE2b-256 9a7463cfc6c1369656078cb76381f3c794803c611d067349baa947b91199e5ee

See more details on using hashes here.

File details

Details for the file pytest-jira-0.2.2-1.noarch.rpm.

File metadata

File hashes

Hashes for pytest-jira-0.2.2-1.noarch.rpm
Algorithm Hash digest
SHA256 bf2ff2c937c9eb4cf4ccac49f27aec58063633ff8856ad9c9d72c190b4d65d86
MD5 9bd41991ec81a5241ab009bcd277c4c9
BLAKE2b-256 fe49dc9adcfde4a7ee951888d6b809f5cf3ff4e10fa5a76bf207b43d5cf3a9fd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page