metaplugins.blockers module

A generalized framowork for handling test blockers.

Currently handling Bugzilla nad GitHub issues. For extensions, see this file and utils.blockers.

If you want to mark test with blockers, use meta mark blockers and specify a list of the blockers. The blockers can be directly the objects of utils.blockers.Blocker subclasses, but you can use just plain strings that will get resolved into the objects when required.

Example comes:

@pytest.mark.meta(
    blockers=[
        BZ(123456),             # Will get resolved to BZ obviously
        GH(1234),               # Will get resolved to GH if you have default repo set
        GH("owner/repo:issue"), # Otherwise you need to use this syntax
        # Generic blocker writing - (<engine_name>#<blocker_spec>)
        # These work for any engine that is in :py:mod:`utils.blockers`
        "BZ#123456",            # Will resolve to BZ
        "GH#123",               # Will resolve to GH (needs default repo specified)
        "GH#owner/repo:123",    # Will resolve to GH
        # Shortcut writing
        123456,                 # Will resolve to BZ
    ]
)

Íf you want to unskip, then you have to use the full object (BZ()) and pass it a kwarg called unblock. When the function in unblock resolves to a truthy value, the test won’t be skipped. If the blocker does not block, the unblock is not called. There is also a custom_action that will get called if the blocker blocks. if the action does nothing, then it continues with next actions etc., until it gets to the point that it skips the test because there are blockers.

metaplugins.blockers.kwargify(f)[source]

Convert function having only positional args to a function taking dictionary.

If you pass False or None, a function which always returns False is returned. If you pass True, a function which always returns True is returned.

metaplugins.blockers.resolve_blockers(item, blockers)[source]