diff --git a/kibot/log.py b/kibot/log.py index dfc94cdc..a757ed20 100644 --- a/kibot/log.py +++ b/kibot/log.py @@ -53,6 +53,11 @@ class MyLogger(logging.Logger): warn_hash = {} warn_tcnt = warn_cnt = n_filtered = 0 + @staticmethod + def reset_warn_hash(): + """ Clean the hash, used for testing """ + MyLogger.warn_hash = {} + def warning(self, msg, *args, **kwargs): MyLogger.warn_tcnt += 1 # Get the message applying optional C style expansions diff --git a/tests/test_plot/test_kicad_config_errors.py b/tests/test_plot/test_kicad_config_errors.py index 1b85cea1..f76fc1c3 100644 --- a/tests/test_plot/test_kicad_config_errors.py +++ b/tests/test_plot/test_kicad_config_errors.py @@ -30,6 +30,7 @@ if prev_dir not in sys.path: from kibot.misc import EXIT_BAD_CONFIG from kibot.kicad.config import KiConf, KiConfError from kibot.gs import GS +from kibot.log import MyLogger cov = coverage.Coverage() @@ -69,6 +70,8 @@ def kiconf_de_init(): def check_load_conf(caplog, dir='kicad', fail=False, catch_conf_error=False, no_conf_path=False): caplog.set_level(logging.DEBUG) kiconf_de_init() + # Repeated messages will be supressed, avoid it + MyLogger.reset_warn_hash() import pcbnew GS.kicad_conf_path = None if no_conf_path else pcbnew.GetKicadConfigPath() with context.cover_it(cov):