Fixed config tests

- The initialization in out_base forced the need of logger reset
This commit is contained in:
Diego Capusotto 2021-12-17 13:34:15 -03:00
parent 6e5176b273
commit 5cf60b0361
2 changed files with 8 additions and 0 deletions

View File

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

View File

@ -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):