1
0
Fork 0

Add some debug messages to check discovery mechanism

This commit is contained in:
Maurizio Porrato 2023-08-14 15:07:01 +01:00
parent 1bc27f38d8
commit e245dd758e
1 changed files with 10 additions and 0 deletions

View File

@ -1,10 +1,13 @@
import importlib
import logging
from collections.abc import Callable, Iterable, Mapping
from inspect import getmembers, isfunction
from typing import Union
from .. import Bundle, Operator, Repo
log = logging.getLogger(__name__)
class CheckResult:
severity: int = 0
@ -53,6 +56,12 @@ def get_checks(
module = importlib.import_module(f"{suite_name}.{module_name}")
for check_name, check in getmembers(module, isfunction):
if check_name.startswith("check_"):
log.debug(
"Detected %s check with name %s in %s",
module_name,
check_name,
suite_name,
)
result[module_name].append(check)
except ModuleNotFoundError:
pass
@ -68,4 +77,5 @@ def run_suite(
for target_type_name, target_type in SUPPORTED_TYPES:
if isinstance(target, target_type):
for check in checks.get(target_type_name, []):
log.debug("Running %s check on %s", check.__name__, target)
yield from check(target)