コード例 #1
0
ファイル: __init__.py プロジェクト: rahulroxx/coala
def skip_if_no_clang():
    """
    Decorate your test with this to skip it if clang isn't present.
    """
    try:
        Index.create()
        return skipIf(False, '')
    except LibclangError as error:
        return skip(str(error))
コード例 #2
0
def generate_skip_decorator(bear):
    """
    Creates a skip decorator for a `unittest` module test from a bear.

    `check_prerequisites` is used to determine a test skip.

    :param bear: The bear whose prerequisites determine the test skip.
    :return:     A decorator that skips the test if appropriate.
    """
    result = bear.check_prerequisites()

    return skip(result) if isinstance(result, str) else skipIf(not result, "(No reason given.)")