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

bears.tests.generate_skip_test()   A

Complexity

Conditions 3

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 3
dl 0
loc 17
rs 9.4286

1 Method

Rating   Name   Duplication   Size   Complexity  
A bears.tests.skip_bear_test() 0 7 2
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