summaryrefslogtreecommitdiffhomepage
path: root/test/unit/main.py
blob: 749ff3abf951649d0521a83344b31dec0a375335 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pytest
from unit.option import option


class TestUnit():
    @classmethod
    def setup_class(cls):
        missed = []

        # check modules

        if 'modules' in cls.prerequisites:
            available_modules = list(option.available['modules'].keys())

            for module in cls.prerequisites['modules']:
                if module in available_modules:
                    continue

                missed.append(module)

        if missed:
            pytest.skip('Unit has no ' + ', '.join(missed) + ' module(s)')

        # check features

        if 'features' in cls.prerequisites:
            available_features = list(option.available['features'].keys())

            for feature in cls.prerequisites['features']:
                if feature in available_features:
                    continue

                missed.append(feature)

        if missed:
            pytest.skip(', '.join(missed) + ' feature(s) not supported')