mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-26 09:15:40 +00:00
test: suppress expected error logs in SSE test (#3886)
Our unit test outputs are filled with all kinds of obscene logs. This makes it really hard to spot real issues quickly. The problem is that these logs are necessary to output at the given logging level when the server is operating normally. It's just that we don't want to see some of them (especially the noisy ones) during tests. This PR begins the cleanup. We pytest's caplog fixture to for suppression.
This commit is contained in:
parent
f8eaa40580
commit
7b90e0e9c8
5 changed files with 60 additions and 17 deletions
|
|
@ -4,9 +4,12 @@
|
|||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
import logging # allow-direct-logging
|
||||
import os
|
||||
import warnings
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def pytest_sessionstart(session) -> None:
|
||||
if "LLAMA_STACK_LOGGING" not in os.environ:
|
||||
|
|
@ -17,4 +20,10 @@ def pytest_sessionstart(session) -> None:
|
|||
warnings.filterwarnings("ignore", category=PendingDeprecationWarning)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def suppress_httpx_logs(caplog):
|
||||
"""Suppress httpx INFO logs for all unit tests"""
|
||||
caplog.set_level(logging.WARNING, logger="httpx")
|
||||
|
||||
|
||||
pytest_plugins = ["tests.unit.fixtures"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue