Skip to content

Commit 2fe84f5

Browse files
committed
Use constant for default logger name
1 parent 5884f20 commit 2fe84f5

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

tests/unit/app/endpoints/test_rlsapi_v1.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,9 @@ async def test_infer_info_logs_omit_user_supplied_content(
706706
),
707707
)
708708

709-
with caplog.at_level(logging.INFO, logger="lightspeed_stack.app.endpoints.rlsapi_v1"):
709+
with caplog.at_level(
710+
logging.INFO, logger=f"{constants.DEFAULT_LOGGER_NAME}..app.endpoints.rlsapi_v1"
711+
):
710712
await infer_endpoint(
711713
infer_request=infer_request,
712714
request=mock_request_factory(),
@@ -786,7 +788,10 @@ async def test_infer_api_status_error_logs_class_without_private_text(
786788
caplog: pytest.LogCaptureFixture,
787789
) -> None:
788790
"""Test API status error logs omit raw exception text."""
789-
with caplog.at_level(logging.ERROR, logger="lightspeed_stack.app.endpoints.rlsapi_v1"):
791+
with caplog.at_level(
792+
logging.ERROR,
793+
logger=f"{constants.DEFAULT_LOGGER_NAME}..app.endpoints.rlsapi_v1",
794+
):
790795
with pytest.raises(HTTPException) as exc_info:
791796
await infer_endpoint(
792797
infer_request=RlsapiV1InferRequest(question="Test question"),

tests/unit/authorization/test_azure_token_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
AzureEntraIDManager,
1818
)
1919
from configuration import AzureEntraIdConfiguration
20+
from constants import DEFAULT_LOGGER_NAME
2021

2122

2223
@pytest.fixture(name="dummy_config")
@@ -137,7 +138,8 @@ def test_refresh_token_failure_logs_error(
137138
)
138139

139140
with caplog.at_level(
140-
"WARNING", logger="lightspeed_stack.authorization.azure_token_manager"
141+
"WARNING",
142+
logger=f"{DEFAULT_LOGGER_NAME}..authorization.azure_token_manager",
141143
):
142144
result = token_manager.refresh_token()
143145

tests/unit/models/config/test_rlsapi_v1_configuration.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import pytest
77
from pydantic import ValidationError
88

9+
from constants import DEFAULT_LOGGER_NAME
910
from models.config import Configuration, RlsapiV1Configuration
1011

1112
# --- Test RlsapiV1Configuration ---
@@ -133,7 +134,9 @@ def test_quota_subject_warns_when_no_limiters(caplog: pytest.LogCaptureFixture)
133134
authentication={"module": "noop"},
134135
quota_handlers={},
135136
)
136-
with caplog.at_level(logging.WARNING, logger="lightspeed_stack.models.config"):
137+
with caplog.at_level(
138+
logging.WARNING, logger=f"{DEFAULT_LOGGER_NAME}..models.config"
139+
):
137140
Configuration(**config_dict)
138141

139142
assert "quota enforcement is not fully configured" in caplog.text
@@ -158,7 +161,9 @@ def test_quota_subject_warns_when_no_storage_backend(
158161
],
159162
},
160163
)
161-
with caplog.at_level(logging.WARNING, logger="lightspeed_stack.models.config"):
164+
with caplog.at_level(
165+
logging.WARNING, logger=f"{DEFAULT_LOGGER_NAME}..models.config"
166+
):
162167
Configuration(**config_dict)
163168

164169
assert "quota enforcement is not fully configured" in caplog.text

0 commit comments

Comments
 (0)