fix(tests): add atexit.register mock to prevent Click isolation stream closure in test_use_prisma_db_push_flag_behavior

This commit is contained in:
Ishaan Jaffer 2026-02-21 14:27:16 -08:00
parent f61dc66a02
commit 6539523eef

View file

@ -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"""