From 7ac1033b95231a83d42379f02f167fc51e5eff7b Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 4 Oct 2026 09:58:05 +0000 Subject: [PATCH] Restore the multi-loop execute_write_many() regression test It fails 3 of 3 runs before the fix on Python 3.11; it had been dropped after being checked, by mistake, against a Python 3.14 environment, where the problem does not occur. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EwkLo2rJWidpkDVT3HkvNv --- tests/test_connection_review_fixes.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/test_connection_review_fixes.py b/tests/test_connection_review_fixes.py index e6eb2ff0..233ae64b 100644 --- a/tests/test_connection_review_fixes.py +++ b/tests/test_connection_review_fixes.py @@ -907,3 +907,28 @@ async def test_startup_hook_can_make_requests(): ds.close() finally: pm.unregister(name="startup_request_plugin") + + +def test_execute_write_many_from_several_event_loops(owned_db): + # T1 end to end: on Python 3.11 before the fix, dozens of these calls + # failed with "bad parameter or other API misuse" (3 of 3 runs) + _ds, db, _path = owned_db + errors = [] + + def loop(i): + async def run(): + async def worker(t): + for seq in range(60): + try: + await db.execute_write_many( + "insert into t (v) values (?)", [(f"{i}-{t}-{seq}",)] + ) + except Exception as e: # noqa: BLE001 + errors.append(repr(e)) + + await asyncio.gather(*(worker(t) for t in range(5))) + + return run + + run_in_threads(loop(0), loop(1), loop(2)) + assert errors == []