From bd9d10da7c30e87424b9ceff15e16a8a076149e8 Mon Sep 17 00:00:00 2001 From: Arnold Galovics Date: Fri, 18 Sep 2026 09:37:54 +0200 Subject: [PATCH] test(tags): suppress TQ008 on the new tests' patch calls These patch litellm.proxy.proxy_server internals the endpoint imports directly, the same unavoidable pattern every other test in this file already uses; the new occurrences pushed the file's TQ008 count over the CI budget. --- .../test_tag_management_endpoints.py | 34 +++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/tests/unit/proxy/management_endpoints/test_tag_management_endpoints.py b/tests/unit/proxy/management_endpoints/test_tag_management_endpoints.py index 817b5da1c0a..ade47398add 100644 --- a/tests/unit/proxy/management_endpoints/test_tag_management_endpoints.py +++ b/tests/unit/proxy/management_endpoints/test_tag_management_endpoints.py @@ -687,11 +687,9 @@ async def test_update_tag_resets_spend(): try: with ( - patch("litellm.proxy.proxy_server.prisma_client") as mock_prisma, - patch( - "litellm.proxy.proxy_server.litellm_proxy_admin_name", "default_user_id" - ), - patch("litellm.proxy.proxy_server.spend_counter_cache") as mock_spend_counter_cache, + patch("litellm.proxy.proxy_server.prisma_client") as mock_prisma, # test-quality-ok: the endpoint imports proxy_server.prisma_client itself; no parameter to inject + patch("litellm.proxy.proxy_server.litellm_proxy_admin_name", "default_user_id"), # test-quality-ok: the endpoint imports proxy_server.litellm_proxy_admin_name itself; no parameter to inject + patch("litellm.proxy.proxy_server.spend_counter_cache") as mock_spend_counter_cache, # test-quality-ok: the endpoint imports proxy_server.spend_counter_cache itself; no parameter to inject ): mock_spend_counter_cache.redis_cache = None @@ -752,11 +750,9 @@ async def test_update_tag_resets_spend_in_redis(): try: with ( - patch("litellm.proxy.proxy_server.prisma_client") as mock_prisma, - patch( - "litellm.proxy.proxy_server.litellm_proxy_admin_name", "default_user_id" - ), - patch("litellm.proxy.proxy_server.spend_counter_cache") as mock_spend_counter_cache, + patch("litellm.proxy.proxy_server.prisma_client") as mock_prisma, # test-quality-ok: the endpoint imports proxy_server.prisma_client itself; no parameter to inject + patch("litellm.proxy.proxy_server.litellm_proxy_admin_name", "default_user_id"), # test-quality-ok: the endpoint imports proxy_server.litellm_proxy_admin_name itself; no parameter to inject + patch("litellm.proxy.proxy_server.spend_counter_cache") as mock_spend_counter_cache, # test-quality-ok: the endpoint imports proxy_server.spend_counter_cache itself; no parameter to inject ): mock_spend_counter_cache.redis_cache = MagicMock() mock_spend_counter_cache.redis_cache.async_set_cache = AsyncMock() @@ -815,11 +811,9 @@ async def test_update_tag_resets_spend_redis_failure_does_not_fail_request(): try: with ( - patch("litellm.proxy.proxy_server.prisma_client") as mock_prisma, - patch( - "litellm.proxy.proxy_server.litellm_proxy_admin_name", "default_user_id" - ), - patch("litellm.proxy.proxy_server.spend_counter_cache") as mock_spend_counter_cache, + patch("litellm.proxy.proxy_server.prisma_client") as mock_prisma, # test-quality-ok: the endpoint imports proxy_server.prisma_client itself; no parameter to inject + patch("litellm.proxy.proxy_server.litellm_proxy_admin_name", "default_user_id"), # test-quality-ok: the endpoint imports proxy_server.litellm_proxy_admin_name itself; no parameter to inject + patch("litellm.proxy.proxy_server.spend_counter_cache") as mock_spend_counter_cache, # test-quality-ok: the endpoint imports proxy_server.spend_counter_cache itself; no parameter to inject ): mock_spend_counter_cache.redis_cache = MagicMock() mock_spend_counter_cache.redis_cache.async_set_cache = AsyncMock( @@ -876,11 +870,9 @@ async def test_update_tag_without_spend_does_not_touch_counter_cache(): try: with ( - patch("litellm.proxy.proxy_server.prisma_client") as mock_prisma, - patch( - "litellm.proxy.proxy_server.litellm_proxy_admin_name", "default_user_id" - ), - patch("litellm.proxy.proxy_server.spend_counter_cache") as mock_spend_counter_cache, + patch("litellm.proxy.proxy_server.prisma_client") as mock_prisma, # test-quality-ok: the endpoint imports proxy_server.prisma_client itself; no parameter to inject + patch("litellm.proxy.proxy_server.litellm_proxy_admin_name", "default_user_id"), # test-quality-ok: the endpoint imports proxy_server.litellm_proxy_admin_name itself; no parameter to inject + patch("litellm.proxy.proxy_server.spend_counter_cache") as mock_spend_counter_cache, # test-quality-ok: the endpoint imports proxy_server.spend_counter_cache itself; no parameter to inject ): mock_db = Mock() mock_prisma.db = mock_db @@ -935,7 +927,7 @@ async def test_update_tag_rejects_non_finite_spend(): ) try: - with patch("litellm.proxy.proxy_server.prisma_client") as mock_prisma: + with patch("litellm.proxy.proxy_server.prisma_client") as mock_prisma: # test-quality-ok: the endpoint imports proxy_server.prisma_client itself; no parameter to inject mock_db = Mock() mock_prisma.db = mock_db mock_db.litellm_tagtable.update = AsyncMock()