mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
style: ruff format spend logs migration test
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
b6fe1d9866
commit
85c5153aec
1 changed files with 6 additions and 9 deletions
|
|
@ -19,9 +19,7 @@ def test_schema_migration_in_sync():
|
|||
matching migration being generated.
|
||||
"""
|
||||
db_url = os.environ["DATABASE_URL"]
|
||||
source_migrations_dir = Path(
|
||||
"./litellm-proxy-extras/litellm_proxy_extras/migrations"
|
||||
)
|
||||
source_migrations_dir = Path("./litellm-proxy-extras/litellm_proxy_extras/migrations")
|
||||
source_schema_path = Path("./schema.prisma")
|
||||
|
||||
temp_base = Path(tempfile.mkdtemp(prefix="litellm_schema_migration_"))
|
||||
|
|
@ -33,9 +31,7 @@ def test_schema_migration_in_sync():
|
|||
shutil.copytree(source_migrations_dir, migrations_dir)
|
||||
|
||||
if not any(migrations_dir.iterdir()):
|
||||
pytest.fail(
|
||||
"No existing migrations found. Run `python litellm/ci_cd/baseline_db_migration.py`."
|
||||
)
|
||||
pytest.fail("No existing migrations found. Run `python litellm/ci_cd/baseline_db_migration.py`.")
|
||||
|
||||
subprocess.run(
|
||||
["prisma", "migrate", "deploy", "--schema", str(schema_path)],
|
||||
|
|
@ -62,8 +58,7 @@ def test_schema_migration_in_sync():
|
|||
if diff.returncode == 2:
|
||||
pytest.fail(
|
||||
"Schema changes detected that no migration captures. Run "
|
||||
"`python litellm/ci_cd/run_migration.py <migration_name>`.\n\n"
|
||||
+ diff.stdout
|
||||
"`python litellm/ci_cd/run_migration.py <migration_name>`.\n\n" + diff.stdout
|
||||
)
|
||||
assert diff.returncode == 0, f"prisma migrate diff errored: {diff.stderr}"
|
||||
finally:
|
||||
|
|
@ -106,7 +101,9 @@ def _api_key_index_migration() -> str:
|
|||
for sql in (path.read_text() for path in MIGRATIONS_DIR.glob("*/migration.sql"))
|
||||
if SPEND_LOGS_API_KEY_INDEX in sql
|
||||
]
|
||||
assert len(creating) == 1, f"expected exactly one migration creating {SPEND_LOGS_API_KEY_INDEX}, found {len(creating)}"
|
||||
assert len(creating) == 1, (
|
||||
f"expected exactly one migration creating {SPEND_LOGS_API_KEY_INDEX}, found {len(creating)}"
|
||||
)
|
||||
return creating[0]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue