Skip to content

Conversation

@emmatyping
Copy link
Member

This is part of fixing the failed tests in #19545

The async tests previously used many invocations of asyncio.run, which likely caused issues with event loop management. The documentation for asyncio.run states:

This function cannot be called when another asyncio event loop is running in the same thread. ...
This function should be used as a main entry point for asyncio programs, and should ideally only be called once.

Calling asyncio.run multiple times could cause the test processes to hang for strange event loop reasons. This commit converts most test cases to be run in a single event loop managed by the default driver, which is now async aware.

Not all tests could be converted, e.g. the test that runs an async function in a sync context. However, the test suite does succeed with these changes, and these tests can be further modified if needed.

The async tests previously used many invocations of `asyncio.run`. This
could cause the test processes to die for strange event loop reasons.
This commit converts most test cases to be run in a single event loop
managed by the default driver, which is now async aware.

Not all tests could be converted, e.g. the test that runs an async
function in a sync context. However, the test suite does succeed with
these changes.
Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG, hopefully this will fix it.

@ilevkivskyi ilevkivskyi merged commit 64dff42 into python:master Aug 4, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants