"""Register test handlers."""from__future__importannotationsfromtypingimportTYPE_CHECKINGfrom.handlersimportcfn_lint,scriptfrom.handlersimportyaml_lintasyamllintifTYPE_CHECKING:from.handlers.baseimportTestHandlerTEST_HANDLERS:dict[str,type[TestHandler]]={}
[docs]defregister_test_handler(test_type:str,handler:type[TestHandler])->None:"""Register a test handler. Args: test_type: Name to register the handler under. handler: Test handler class. """TEST_HANDLERS[test_type]=handler
[docs]defunregister_test_handler(test_type:str)->None:"""Unregister the specified test type. This is useful when testing various lookup types if you want to unregister the lookup type after the test runs. Args: test_type (str): Name of the lookup type to unregister. """TEST_HANDLERS.pop(test_type,None)