From 6539523eefc8a568c341a9cb2024a814757632ef Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Sat, 21 Feb 2026 14:27:16 -0800 Subject: [PATCH] fix(tests): add atexit.register mock to prevent Click isolation stream closure in test_use_prisma_db_push_flag_behavior --- tests/test_litellm/proxy/test_proxy_cli.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_litellm/proxy/test_proxy_cli.py b/tests/test_litellm/proxy/test_proxy_cli.py index 236080aab7e..cf14cf5bd65 100644 --- a/tests/test_litellm/proxy/test_proxy_cli.py +++ b/tests/test_litellm/proxy/test_proxy_cli.py @@ -583,6 +583,7 @@ class TestHealthAppFactory: assert isinstance(health_app_2, fastapi.FastAPI) @patch("subprocess.run") + @patch("atexit.register") # critical: prevents atexit handlers from closing Click's isolation streams @patch("litellm.proxy.db.prisma_client.PrismaManager.setup_database") @patch("litellm.proxy.db.check_migration.check_prisma_schema_diff") @patch("litellm.proxy.db.prisma_client.should_update_prisma_schema") @@ -591,6 +592,7 @@ class TestHealthAppFactory: mock_should_update_schema, mock_check_schema_diff, mock_setup_database, + mock_atexit_register, mock_subprocess_run, ): """Test that use_prisma_db_push flag correctly controls PrismaManager.setup_database use_migrate parameter"""