Completed
Pull Request — master (#1160)
by Mischa
01:40
created

bears.tests.skip_bear_test()   A

Complexity

Conditions 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 2
dl 0
loc 7
rs 9.4286
1
def generate_skip_test(bear):
2
    """
3
    Creates a skip_test function for a `unittest` module test from a bear.
4
5
    `check_prerequisites` is used to determine a test skip.
6
7
    :param bear: The bear whose prerequisites determine the test skip.
8
    """
9
    def skip_bear_test():
10
        result = bear.check_prerequisites()
11
12
        if isinstance(result, str):
13
            return result
14
        else:
15
            return not result
16
17
    return skip_bear_test
18