Coverage for src/dirschema/json/handlers.py: 100%
4 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-07 09:34 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-07 09:34 +0000
1"""Loading of the validation handlers found in the current environment."""
3import entrypoints
5from .handler import ValidationHandler
7loaded_handlers = {
8 ep.name: ep.load() for ep in entrypoints.get_group_all(group="dirschema_validator")
9}
10"""
11Dict mapping from registered ValidationHandlers to the corresponding classes.
12"""
14for k, v in loaded_handlers.items(): # pragma: no cover
15 if not issubclass(v, ValidationHandler):
16 msg = f"Registered validation handler not subclass of ValidationHandler: '{k}'"
17 raise RuntimeError(msg)