aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_constants.py
blob: e4a29d9944041fed3ea104979026821a9148e38b (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
import inspect

import pytest

from bot import constants


@pytest.mark.parametrize(
    'section',
    (
        cls
        for (name, cls) in inspect.getmembers(constants)
        if hasattr(cls, 'section') and isinstance(cls, type)
    )
)
def test_section_configuration_matches_typespec(section):
    for (name, annotation) in section.__annotations__.items():
        value = getattr(section, name)

        if getattr(annotation, '_name', None) in ('Dict', 'List'):
            pytest.skip("Cannot validate containers yet")

        assert isinstance(value, annotation)