From d8ccebf9bb8252c480643bd91816f752dcbbe64d Mon Sep 17 00:00:00 2001 From: Roland Date: Mon, 14 Apr 2025 22:20:30 -0600 Subject: [PATCH] Skipping warn_once warnings when pytest is running. --- wrolpi/common.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wrolpi/common.py b/wrolpi/common.py index 87b2672a..d5601498 100644 --- a/wrolpi/common.py +++ b/wrolpi/common.py @@ -1772,6 +1772,10 @@ def get_warn_once(message: str, logger__: logging.Logger, level=logging.ERROR): This is used when a function will be called many times, but the error is not important.""" def warn_once(exception: Exception): + if PYTEST: + # No need to fill pytest logs with these warnings. + return + from wrolpi.api_utils import api_app if not api_app.shared_ctx.warn_once.get(message): logger__.log(level, message, exc_info=exception)