Completed
Pull Request — master (#1183)
by Lasse
01:39
created

bears.tests.c_languages.skip_if_no_clang()   A

Complexity

Conditions 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 2
dl 0
loc 9
rs 9.6667
1
from unittest.case import skipIf, skip
2
3
from clang.cindex import Index, LibclangError
4
5
6
def skip_if_no_clang():
7
    """
8
    Decorate your test with this to skip it if clang isn't present.
9
    """
10
    try:
11
        Index.create()
12
        return skipIf(False, '')
13
    except LibclangError as error:
14
        return skip(str(error))
15