Coverage for src/dirschema/json/handlers.py: 100%

4 statements  

« prev     ^ index     » next       coverage.py v7.2.5, created at 2023-05-08 15:24 +0000

1"""This module loads the validation handlers found in the current environment.""" 

2 

3import entrypoints 

4 

5from .handler import ValidationHandler 

6 

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""" 

13 

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)