From cda3c22ae38ce0411246505c5f0e62096f49377b Mon Sep 17 00:00:00 2001 From: d3vyce Date: Tue, 31 Mar 2026 17:00:23 -0400 Subject: [PATCH] fix: pytest warnings --- src/fastapi_toolsets/exceptions/handler.py | 2 +- src/fastapi_toolsets/metrics/handler.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fastapi_toolsets/exceptions/handler.py b/src/fastapi_toolsets/exceptions/handler.py index d21e3c9..dd7b0a3 100644 --- a/src/fastapi_toolsets/exceptions/handler.py +++ b/src/fastapi_toolsets/exceptions/handler.py @@ -122,7 +122,7 @@ def _format_validation_error( ) return JSONResponse( - status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, + status_code=status.HTTP_422_UNPROCESSABLE_CONTENT, content=error_response.model_dump(), ) diff --git a/src/fastapi_toolsets/metrics/handler.py b/src/fastapi_toolsets/metrics/handler.py index e2e7ea9..ff63b32 100644 --- a/src/fastapi_toolsets/metrics/handler.py +++ b/src/fastapi_toolsets/metrics/handler.py @@ -1,6 +1,6 @@ """Prometheus metrics endpoint for FastAPI applications.""" -import asyncio +import inspect import os from fastapi import FastAPI @@ -55,10 +55,10 @@ def init_metrics( # Partition collectors and cache env check at startup — both are stable for the app lifetime. async_collectors = [ - c for c in registry.get_collectors() if asyncio.iscoroutinefunction(c.func) + c for c in registry.get_collectors() if inspect.iscoroutinefunction(c.func) ] sync_collectors = [ - c for c in registry.get_collectors() if not asyncio.iscoroutinefunction(c.func) + c for c in registry.get_collectors() if not inspect.iscoroutinefunction(c.func) ] multiprocess_mode = _is_multiprocess()