Fix hanging test suite by closing per-loop Tortoise contexts

pwo.async_test runs every test in a fresh event loop and TortoiseMixin
builds one TortoiseContext per loop. Dropping the previous context when
the loop changed orphaned its aiosqlite connections; their non-daemon
worker threads then blocked threading._shutdown forever, so the suite
printed OK but the interpreter never exited.

Add TortoiseMixin.aclose() and a tests.helpers.async_test wrapper that
closes the context in a finally on the test's own loop, and switch the
test modules over to it.
This commit is contained in:
2026-09-19 03:20:24 +00:00
parent af480bb9b7
commit 031d933204
10 changed files with 57 additions and 14 deletions
+1 -2
View File
@@ -11,12 +11,11 @@ import unittest
from datetime import datetime, timedelta, timezone
from typing import Optional
from pwo import async_test
from tavolo import deadlines
from tavolo.app import game_store
from tavolo.game import engine
from tavolo.game.state import GameState, PlayerState
from tests.helpers import async_test
PLAYERS = ("alice", "bob", "carol", "dave")