mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Skipping warn_once warnings when pytest is running.
This commit is contained in:
parent
3843279746
commit
d8ccebf9bb
1 changed files with 4 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue