test: skip unconfigured Postgres tests before importing psycopg
Merged
MA
2mo ago+6+6+0123456789-7-7-0123456789
On Python 3.15, the workspace uses pure-Python psycopg, which requires a system libpq. The macOS unit job fails during collection because the runner test module imports psycopg before pytest can apply its no-database skip marker.
Skip the Postgres-only module before importing psycopg when REFLEX_TEST_POSTGRES is unset or empty. An explicitly configured database still requires a working driver and surfaces import failures. This only changes test collection.
Type of change
- Bug fix (test-only)
Validation
- With psycopg unavailable, manual import probes skip for unset and empty database URLs and report the missing driver for a configured URL.
- All 134 runner tests collect with a configured URL and available driver.
- Affected CLI and workflow test modules: 882 passed, 5 skipped on macOS/Python 3.14 with Node 22.
- Ruff lint and formatting checks passed; commit hooks include codespell, stub generation, Pyright, and ty.
- Adversarial review found no actionable issues.
No news fragment: test-only change.