Skip to content

fix(deps): add pytest-postgresql for db schema migration tests#21280

Merged
jquinter merged 3 commits intomainfrom
fix/add-pytest-postgresql-dependency
Feb 16, 2026
Merged

fix(deps): add pytest-postgresql for db schema migration tests#21280
jquinter merged 3 commits intomainfrom
fix/add-pytest-postgresql-dependency

Conversation

@jquinter
Copy link
Contributor

Summary

Fixes import error in tests/proxy_unit_tests/test_db_schema_migration.py.

Problem

The test file requires pytest-postgresql but it's not in the project dependencies:

from pytest_postgresql import factories
ModuleNotFoundError: No module named 'pytest_postgresql'

This causes test collection to fail in the proxy-unit test groups.

Root Cause

The dependency was never added when test_db_schema_migration.py was created. This is a pre-existing issue, not caused by any recent changes.

Solution

Added pytest-postgresql = "^6.0.0" to [tool.poetry.group.dev.dependencies] in pyproject.toml.

Testing

After this fix, the test file can be collected without errors:

pytest tests/proxy_unit_tests/test_db_schema_migration.py --collect-only

Related

This error was exposed during CI testing but is not related to:

Simply a missing dependency that needs to be added.

🤖 Generated with Claude Code

The test_db_schema_migration.py test requires pytest-postgresql but it was
missing from dependencies, causing import errors:

  ModuleNotFoundError: No module named 'pytest_postgresql'

Added pytest-postgresql ^6.0.0 to dev dependencies to fix test collection
errors in proxy_unit_tests.

This is a pre-existing issue, not related to PR #21277.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 16, 2026 3:05pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 15, 2026

Greptile Summary

Adds the missing pytest-postgresql dev dependency (^6.0.0) to pyproject.toml, fixing a ModuleNotFoundError that prevented test collection for tests/proxy_unit_tests/test_db_schema_migration.py. The poetry.lock file is regenerated to include pytest-postgresql and its transitive dependencies (mirakuru, port-for, psutil, psycopg, setuptools).

  • The pyproject.toml change is a single-line addition, correctly placed in [tool.poetry.group.dev.dependencies]
  • The lock file was regenerated with Poetry 2.1.4 instead of 2.2.0 (which was used previously), which may cause minor churn
  • The PR description clearly explains the root cause and includes evidence of the fix (test collection succeeds after the change)

Confidence Score: 4/5

  • This PR is safe to merge — it only adds a missing dev test dependency with no impact on production code.
  • Score of 4 reflects a straightforward, low-risk dependency addition. The only minor concern is the Poetry version mismatch (2.2.0 → 2.1.4) in the lock file header, which won't affect functionality but could cause lock file churn for other contributors.
  • The poetry.lock file was regenerated with a different Poetry version (2.1.4 vs 2.2.0), worth a quick check for consistency with the team's Poetry version.

Important Files Changed

Filename Overview
pyproject.toml Adds pytest-postgresql = "^6.0.0" to dev dependencies. Correctly placed alongside other pytest plugins. Straightforward and correct.
poetry.lock Lock file regenerated with new transitive dependencies (mirakuru, port-for, psutil, psycopg, setuptools) for pytest-postgresql. Poetry version changed from 2.2.0 to 2.1.4 in the header comment, which could cause lock file churn.

Flowchart

flowchart TD
    A[pyproject.toml] -->|adds| B[pytest-postgresql ^6.0.0]
    B -->|depends on| C[mirakuru]
    B -->|depends on| D[port-for >=0.7.3]
    B -->|depends on| E[psycopg >=3.0.0]
    B -->|depends on| F[setuptools]
    B -->|depends on| G[pytest >=6.2]
    C -->|depends on| H[psutil]
    E -->|depends on| I[tzdata - Windows only]
    B -->|used by| J[test_db_schema_migration.py]
    J -->|imports| K["from pytest_postgresql import factories"]
Loading

Last reviewed commit: 32adfa2

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

poetry.lock Outdated
@@ -1,4 +1,4 @@
# This file is automatically @generated by Poetry 2.2.0 and should not be changed by hand.
# This file is automatically @generated by Poetry 2.1.4 and should not be changed by hand.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Poetry version downgrade in lock file

The lock file was regenerated with Poetry 2.1.4, but the previous lock file was generated with Poetry 2.2.0. This version mismatch could cause unnecessary lock file churn if other contributors use Poetry 2.2.0. Consider regenerating the lock file with the same Poetry version used by the rest of the team to keep things consistent.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Updated lock file to use Poetry 2.3.2 (matching main branch standard).
This addresses Greptile feedback about Poetry version mismatch.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Resolved poetry.lock conflict by regenerating with Poetry 2.3.2.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@jquinter jquinter merged commit a2ce7fc into main Feb 16, 2026
15 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant