mirror of
https://github.com/tiennm99/litellm.git
synced 2026-06-23 19:36:24 +00:00
93b6df96e0
* build(litellm-proxy-extras/utils.py): correctly generate baseline migration for non-empty db * fix(litellm-proxy-extras/utils.py): Fix issue in migration, where if a migration fails during baselining, all are still marked as applied * fix(prisma_client.py): don't pass separate schema.prisma to litellm-proxy-extras use the one in litellm-proxy-extras * fix(litellm-proxy-extras/utils.py): support passing custom dir for baselining db in read-only fs Fixes https://github.com/BerriAI/litellm/issues/9885 * fix(utils.py): give helpful warning message when permission denied error raised in fs
33 lines
901 B
Python
33 lines
901 B
Python
import json
|
|
import os
|
|
import sys
|
|
import httpx
|
|
import pytest
|
|
import respx
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
sys.path.insert(
|
|
0, os.path.abspath("../..")
|
|
) # Adds the parent directory to the system path
|
|
|
|
from litellm_proxy_extras.utils import ProxyExtrasDBManager
|
|
|
|
def test_custom_prisma_dir(monkeypatch):
|
|
import tempfile
|
|
# create a temp directory
|
|
temp_dir = tempfile.mkdtemp()
|
|
monkeypatch.setenv("LITELLM_MIGRATION_DIR", temp_dir)
|
|
|
|
## Check if the prisma dir is the temp directory
|
|
assert ProxyExtrasDBManager._get_prisma_dir() == temp_dir
|
|
|
|
## Check if the schema.prisma file is in the temp directory
|
|
schema_path = os.path.join(temp_dir, "schema.prisma")
|
|
assert os.path.exists(schema_path)
|
|
|
|
## Check if the migrations dir is in the temp directory
|
|
migrations_dir = os.path.join(temp_dir, "migrations")
|
|
assert os.path.exists(migrations_dir)
|
|
|