Skip to main content

a special outcome for tests that are blocked for external reasons

Project description

A pytest outcome for tests you dont run for external/environmental reason.

examples of such reasons reasons are:

  • lack of access to a bugtracker telling you what tests apply for the current version of software under test

  • lack of access to a backend service providing essential details for the tests in question

  • issue in a bugtracker is unresolved

  • failure of the internet connection

install

$ pip install pytest-external-blockers

use

import os
import pytest
from .issues import get_tracker

pytestmark = pytest.mark.skipif(
    "BUGTRACKER" in os.environ,
    reason="no bugtracker configured")

@pytest.fixture(scope="session")
def bugtracker():
    try:
        return get_tracker():
    except Exception:
        pytest.block("bugtracker unavailiable")


@pytest.fixture(autouse=True)
def _block_unresolved(request, bugtracker):
    issue = request.node.getmarker('issue')
    if issue is not None:
        for issue_id in issue.args:
            if bugtracker.is_unresolved(issue_id)
                pytest.block(
                    "{issue_id} was not resolved".format(issue_id))

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_external_blockers-0.1.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file pytest_external_blockers-0.1.1.tar.gz.

File metadata

  • Download URL: pytest_external_blockers-0.1.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for pytest_external_blockers-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d2e88ff2eaae943d1102372ba29fb8b464567d9e8bc18e89ad8785a2f0fea0de
MD5 dbb6b7149c5ea5c42c04a37a5de9a97b
BLAKE2b-256 c39954716ce822b804a40a132bfd502f8c89b42c932a79b923c6e7f7ae8f21d2

See more details on using hashes here.

File details

Details for the file pytest_external_blockers-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pytest_external_blockers-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for pytest_external_blockers-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d0ebdbf144bbc1540c5310438847ba59c940a920b3fe37149b62a70cda41bec
MD5 d9091a8ec506cd642c8b7796ebe47e29
BLAKE2b-256 c7dd4f10ef823d98beb9de1f4787a0d4514f412724e878a847691f24de117d06

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