Browse Source

Tests: hide asyncpg's pending cancel task at worker shutdown

- on PostgreSQL an asyncpg Connection._cancel task can still be
  pending when a test worker shuts down; it is finalized then and
  reported as an unraisable warning on whatever test ran last
- conftest already waits for these per test; pytest.ini now
  ignores the rest, matched on that coroutine only, so other
  unraisable exceptions still show
maziggy 1 day ago
parent
commit
871f28e160
1 changed files with 5 additions and 0 deletions
  1. 5 0
      backend/tests/pytest.ini

+ 5 - 0
backend/tests/pytest.ini

@@ -14,6 +14,11 @@ filterwarnings =
     # full move to httpx2 is its own change. Match by message text so the
     # full move to httpx2 is its own change. Match by message text so the
     # filter holds regardless of which warning class starlette uses.
     # filter holds regardless of which warning class starlette uses.
     ignore:Using .httpx. with .starlette.testclient. is deprecated
     ignore:Using .httpx. with .starlette.testclient. is deprecated
+    # asyncpg's query-cancel task on PostgreSQL, still pending when a test
+    # worker shuts down and finalized then (KeyError '__import__'), so it is
+    # pinned on whatever test ran last. conftest waits for these per test;
+    # this hides the rest. Only this coroutine: other unraisables still show.
+    ignore:Exception ignored in. <coroutine object Connection._cancel:pytest.PytestUnraisableExceptionWarning
 markers =
 markers =
     unit: Unit tests (fast, no external deps)
     unit: Unit tests (fast, no external deps)
     integration: Integration tests (slower, test full API)
     integration: Integration tests (slower, test full API)