Skip to content

Remove pytest-asyncio pin#14939

Merged
krassowski merged 2 commits into
ipython:mainfrom
ianthomas23:remove-pytest-asyncio-pin
Jul 19, 2025
Merged

Remove pytest-asyncio pin#14939
krassowski merged 2 commits into
ipython:mainfrom
ianthomas23:remove-pytest-asyncio-pin

Conversation

@ianthomas23
Copy link
Copy Markdown
Collaborator

The downstream ipykernel tests using the recent changes on the main branch there are failing here with

ERROR tests/inprocess/test_kernel.py::test_do_execute - DeprecationWarning: pytest-asyncio detected an unclosed event loop when tearing down the event_loop
fixture: <_UnixSelectorEventLoop running=False closed=False debug=False>
pytest-asyncio will close the event loop for you, but future versions of the
library will no longer do so. In order to ensure compatibility with future
versions, please make sure that:
    1. Any custom "event_loop" fixture properly closes the loop after yielding it
    2. The scopes of your custom "event_loop" fixtures do not overlap
    3. Your code does not modify the event loop in async fixtures or tests
=========================== 184 passed, 19 skipped, 1 warning, 1 error in 102.33s (0:01:42) ============================

Currently we pin pytest-asyncio<0.22 here whereas in ipykernel we use pytest-asyncio>=0.23.5 so the two pins are not compatible. Both projects do not pin pytest so use 8.4.1.

According to the pytest-asyncio changelog for compatibility with pytest>=8 we need at least pytest-asyncio>=0.23.5.

If I remove the pytest-asyncio pin locally then all tests pass on both Ubuntu and macOS, so this PR is seeing what happens without the pin on the full CI matrix.

@ianthomas23
Copy link
Copy Markdown
Collaborator Author

It looks like this was already started in #14784.

@ianthomas23
Copy link
Copy Markdown
Collaborator Author

The mypy failure is unrelated, it wants the type:ignore at

is None # type:ignore [redundant-expr]

to be on the previous line. If you move it then darker in pre-commit moves it back and makes the surrounding formatting even worse. 😄

Copy link
Copy Markdown
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

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

Thank you @ianthomas23! Fixing the mypy issue in #14941.

@krassowski krassowski merged commit b16661a into ipython:main Jul 19, 2025
17 of 18 checks passed
@krassowski krassowski added this to the 9.5 milestone Jul 19, 2025
krassowski added a commit that referenced this pull request Jul 19, 2025
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