style: format with ruff
This commit is contained in:
1 parent
13bddd43c7
commit
b0863e5ddb
181 files changed
+2237
-5272
No files matched your search
@@ -77,9 +77,7 @@ async def test_automation_error_not_critical_returns_422(app, mock_request):
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_automation_error_critical_via_instance_flag_returns_503(
|
||||
app, mock_request
|
||||
):
|
||||
async def test_automation_error_critical_via_instance_flag_returns_503(app, mock_request):
|
||||
# Instance-level override: critical=True
|
||||
exc = MountingFailed("threshold breached", critical=True)
|
||||
handler = app.exception_handlers[AutomationError]
|
||||
@@ -90,9 +88,7 @@ async def test_automation_error_critical_via_instance_flag_returns_503(
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_automation_error_context_contains_endpoint_and_operation(
|
||||
app, mock_request
|
||||
):
|
||||
async def test_automation_error_context_contains_endpoint_and_operation(app, mock_request):
|
||||
exc = TellCommunicationError(
|
||||
"timeout", endpoint="/state", operation="GET", base_url="http://tell:8000"
|
||||
)
|
||||
@@ -106,9 +102,7 @@ async def test_automation_error_context_contains_endpoint_and_operation(
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_automation_error_excludes_critical_and_headers_from_context(
|
||||
app, mock_request
|
||||
):
|
||||
async def test_automation_error_excludes_critical_and_headers_from_context(app, mock_request):
|
||||
# critical kwarg should not appear in context (it has its own field)
|
||||
exc = MountingFailed("x", critical=True)
|
||||
handler = app.exception_handlers[AutomationError]
|
||||
@@ -244,9 +238,7 @@ async def test_unhandled_exception_is_critical_500(app, mock_request):
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_unhandled_exception_empty_message_falls_back_to_class_name(
|
||||
app, mock_request
|
||||
):
|
||||
async def test_unhandled_exception_empty_message_falls_back_to_class_name(app, mock_request):
|
||||
exc = ValueError()
|
||||
handler = app.exception_handlers[Exception]
|
||||
response = await handler(mock_request, exc)
|
||||
@@ -281,9 +273,7 @@ def test_only_four_root_handlers_plus_fallbacks(app):
|
||||
|
||||
registered = set(app.exception_handlers.keys())
|
||||
expected = {AutomationError, AareUserError, AareAuthError, HTTPException, Exception}
|
||||
assert expected.issubset(registered), (
|
||||
f"Missing required handlers: {expected - registered}"
|
||||
)
|
||||
assert expected.issubset(registered), f"Missing required handlers: {expected - registered}"
|
||||
|
||||
# No leftover per-class handlers from the old design
|
||||
forbidden = {
|
||||
@@ -318,9 +308,7 @@ async def test_automation_error_logs_error_when_critical(app, mock_request, capl
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_automation_error_logs_warning_when_not_critical(
|
||||
app, mock_request, caplog
|
||||
):
|
||||
async def test_automation_error_logs_warning_when_not_critical(app, mock_request, caplog):
|
||||
exc = MountingFailed("benign")
|
||||
handler = app.exception_handlers[AutomationError]
|
||||
caplog.clear()
|
||||
@@ -345,10 +333,7 @@ async def test_response_body_shape_uniform(app, mock_request):
|
||||
cases: list[tuple[type, Exception]] = [
|
||||
(AutomationError, MountingFailed("x")),
|
||||
(AutomationError, LoopCenteringFailed("y")),
|
||||
(
|
||||
AutomationError,
|
||||
SmargonCommunicationError("z", operation="GET", endpoint="/e"),
|
||||
),
|
||||
(AutomationError, SmargonCommunicationError("z", operation="GET", endpoint="/e")),
|
||||
(AutomationError, AareDBCommunicationError("db", critical=True)),
|
||||
(AareUserError, ManualMountException("m")),
|
||||
(AareUserError, SampleException("s")),
|
||||
|
||||
Reference in new issue
Block a user