aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2019-09-15 16:48:10 +0200
committerGravatar scragly <[email protected]>2019-09-18 00:50:50 +1000
commit0d27d5d0edf17fec789b752700e9e4a753f45df0 (patch)
treed5a8ab211a71c5e15073977915bd24de833600b6 /tests
parentAdd coverage reporting & JUnit XML to tests. (#432) (diff)
Validate configuration against typehints.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_constants.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_constants.py b/tests/test_constants.py
new file mode 100644
index 000000000..e4a29d994
--- /dev/null
+++ b/tests/test_constants.py
@@ -0,0 +1,23 @@
+import inspect
+
+import pytest
+
+from bot import constants
+
+
+ '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)