Skip to content

PostgreSQL Test Warnings Status

What we tried

  • Reworked backends/netherframe.backends.postgresql backend cleanup to await pool closes and avoid cross-loop issues.
  • Added a custom PostgreSQL container subclass to avoid the deprecated @wait_container_is_ready decorator and used manual readiness checks.
  • Ran full suite with its container tests enabled (now pytest --nf-use-containers); all tests pass.

Remaining warnings and why

  • Deprecation warnings: testcontainers 4.14.0 still emits deprecation notices when testcontainers.core.waiting_utils is imported (the module uses @wait_container_is_ready internally). Although structured wait strategies now exist (testcontainers.core.wait_strategies.LogMessageWaitStrategy, ExecWaitStrategy, etc.), the warning is triggered at import time, so we cannot avoid it without upgrading/patching the library.
  • Runtime warnings about Pool.close not awaited: These surface during testcontainers teardown when the Postgres container stops and asyncpg attempts to close pools on shutting event loops. Backend code now awaits its own pools; the warnings originate upstream in testcontainers/asyncpg teardown.

Next steps to fully remove warnings

  1. Upgrade or patch testcontainers to a release that supports structured wait strategies (e.g., container.waiting_for(LogMessageWaitStrategy(...))) and removes the deprecated decorator usage.
  2. Adjust teardown in testcontainers (or vendor a minimal wrapper) so pool.close is awaited on a live loop during container shutdown.

Until testcontainers is upgraded or patched, the warnings are expected despite the backend and tests passing. The codebase changes here focus on keeping our side clean; remaining messages are upstream.

Note: The @wait_container_is_ready warning is expected to disappear in the next testcontainers release; once we upgrade, we should be able to remove the filterwarnings entry.