MagicStack / MagicStack/asyncpg

Test failure in test_pool_handles_transaction_exit_in_asyncgen_2 with Python 3.15.0a5, PYTHONASYNCIODEBUG=1

Open
#1,300 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.1k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

```
$ git clone https://github.com/MagicStack/asyncpg.git
$ cd asyncpg
$ git submodule update --init --recursive
$ uv venv --python 3.15
Using CPython 3.15.0a5 interpreter at: /usr/bin/python3.15
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
$ uv pip install -e .[gssauth]
$ uv pip install --group test
$ PYTHONASYNCIODEBUG=1 pytest -v
[…]
________________________________________________________________ TestPool.test_pool_handles_transaction_exit_in_asyncgen_2 _________________________________________________________________
Traceback (most recent call last):
File "/usr/lib64/python3.15/unittest/case.py", line 58, in testPartExecutor
yield
File "/usr/lib64/python3.15/unittest/case.py", line 667, in run
self._callTestMethod(testMethod)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/usr/lib64/python3.15/unittest/case.py", line 613, in _callTestMethod
result = method()
File "/home/ben/src/forks/asyncpg/asyncpg/_testbase/__init__.py", line 92, in wrapper
self.loop.run_until_complete(coro)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/lib64/python3.15/asyncio/base_events.py", line 719, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
RuntimeError: cannot reuse already awaited coroutine
```

The above instructions also result in `TestConnectionAttributes.test_prefer_standby_picks_master_when_standby_is_down` failing due to a timeout, but I’m not seeing that when I build https://src.fedoraproject.org/rpms/python-asyncpg.

The test `TestPool.test_pool_handles_transaction_exit_in_asyncgen_2` passes when `PYTHONASYNCIODEBUG=1` is not set.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with Python 3.15.0a5, PYTHONASYNCIODEBUG=1, and the documented pytest command. Start with TestPool.test_pool_handles_transaction_exit_in_asyncgen_2 and asyncpg/_testbase/__init__.py:92, then compare the run without asyncio debug and check the separate standby timeout; done means the reported test failures are understood and resolved or clearly isolated.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.