Skip to content

Bump pytest-asyncio from 1.3.0 to 1.4.0#363

Merged
wojcikstefan merged 3 commits into
masterfrom
dependabot-uv-pytest-asyncio-1.4.0
Jun 25, 2026
Merged

Bump pytest-asyncio from 1.3.0 to 1.4.0#363
wojcikstefan merged 3 commits into
masterfrom
dependabot-uv-pytest-asyncio-1.4.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github May 30, 2026

Copy link
Copy Markdown
Contributor

Bumps pytest-asyncio from 1.3.0 to 1.4.0.

Had to make some changes to get the tests to pass as the newest version of pytest-asyncio can no longer be relied upon to provide an implicit event loop for synchronous tests.

What

Bumps pytest-asyncio 1.3.0 → 1.4.0 and adds a custom current_event_loop fixture to the synchronous tests in tests/test_basic.py.

Why we implemented our own event loop fixture

Several tests (TestShark, TestWebsocket) contain synchronous test functions that need a running event loop in order to run Backend.start() as that method calls asyncio.get_event_loop(). get_event_loop() creating its own loop throws a DeprecationWarning and not a RuntimeError in Python 3.12, however, since the loop was explicitly set to None by pytest-asyncio during previous test teardown, it DOES throw a RuntimeError.

pytest-asyncio calls set_event_loop(None) on test teardown. In v1.3.0 it would also call _set_event_loop() passing in the old loop to provide an event loop to each test. After this change, that is no longer the case.

Result

All 49 tests pass; the previous "no current event loop" failures and the test_shark_init warning are resolved.

Release notes

Sourced from pytest-asyncio's releases.

pytest-asyncio v1.4.0

1.4.0 - 2026-05-26

Deprecated

  • Overriding the event_loop_policy fixture is deprecated. Use the pytest_asyncio_loop_factories hook instead. (#1419)

Added

  • Added the pytest_asyncio_loop_factories hook to parametrize asyncio tests with custom event loop factories.

    The hook returns a mapping of factory names to loop factories, and pytest.mark.asyncio(loop_factories=[...]) selects a subset of configured factories per test. When a single factory is configured, test names are unchanged.

    Synchronous @pytest_asyncio.fixture functions now see the correct event loop when custom loop factories are configured, even when test code disrupts the current event loop (e.g., via asyncio.run() or asyncio.set_event_loop(None)). (#1164)

Changed

  • Improved the readability of the warning message that is displayed when asyncio_default_fixture_loop_scope is unset (#1298)
  • Only import asyncio.AbstractEventLoopPolicy for type checking to avoid raising a DeprecationWarning. (#1394)
  • Updated minimum supported pytest version to v8.4.0. (#1397)

Fixed

  • Fixed a ResourceWarning: unclosed event loop warning that could occur when a synchronous test called asyncio.run() or otherwise unset the current event loop after pytest-asyncio had run an async test or fixture. (#724)

Notes for Downstream Packagers

  • Added dependency on sphinx-tabs >= 3.5 to organize documentation examples into tabs. (#1395)

pytest-asyncio v1.4.0a2

1.4.0a2 - 2026-05-02

Deprecated

  • Overriding the event_loop_policy fixture is deprecated. Use the pytest_asyncio_loop_factories hook instead. (#1419)

Added

  • Added the pytest_asyncio_loop_factories hook to parametrize asyncio tests with custom event loop factories.

    The hook returns a mapping of factory names to loop factories, and pytest.mark.asyncio(loop_factories=[...]) selects a subset of configured factories per test. When a single factory is configured, test names are unchanged on pytest 8.4+.

    Synchronous @pytest_asyncio.fixture functions now see the correct event loop when custom loop factories are configured, even when test code disrupts the current event loop (e.g., via asyncio.run() or asyncio.set_event_loop(None)). (#1164)

Changed

  • Improved the readability of the warning message that is displayed when asyncio_default_fixture_loop_scope is unset (#1298)
  • Only import asyncio.AbstractEventLoopPolicy for type checking to avoid raising a DeprecationWarning. (#1394)

... (truncated)

Commits
  • 6e14cd2 chore: Prepare release of v1.4.0.
  • 4b900fb Build(deps): Bump codecov/codecov-action from 6.0.0 to 6.0.1
  • ab9f632 Build(deps): Bump zipp from 3.23.1 to 4.1.0
  • a56fc77 Build(deps): Bump hypothesis from 6.152.6 to 6.152.8
  • e8bae9b Build(deps): Bump requests from 2.34.0 to 2.34.2
  • fc43340 Build(deps): Bump idna from 3.14 to 3.15
  • 762eaf5 Build(deps): Bump jaraco-functools from 4.4.0 to 4.5.0
  • b62e222 Build(deps): Bump click from 8.3.3 to 8.4.0
  • 9190447 Build(deps): Bump pydantic from 2.13.3 to 2.13.4
  • 82a393c ci: Remove unnecessary debug output.
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](pytest-dev/pytest-asyncio@v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-version: 1.4.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot @github

dependabot Bot commented on behalf of github May 30, 2026

Copy link
Copy Markdown
Contributor Author

Assignees

The following users could not be added as assignees: closeio/communications-backend. Either the username does not exist or it does not have the correct permissions to be added as an assignee.

Please fix the above issues or remove invalid values from dependabot.yml.

@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python:uv Pull requests that update python:uv code labels May 30, 2026
@dependabot dependabot Bot requested a review from a team as a code owner May 30, 2026 05:12
@FFX01 FFX01 requested a review from curtisdf June 24, 2026 18:49
Comment thread tests/test_basic.py Outdated
Comment thread tests/test_basic.py Outdated
@pytest.fixture
def current_event_loop():
"""
Provide a current event loop on the main thread for synchronous tests that

@wojcikstefan wojcikstefan Jun 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What does the "on the main thread" mean in this context? What other threads are used?

And what does it mean to "drive the loop"? Is that some standard vocabulary? Why is calling shark.start "driving" the loop?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does the "on the main thread" mean in this context? What other threads are used?

That was referencing the error message: RuntimeError: There is no current event loop in thread 'MainThread'. Updated the description to be more clear.

And what does it mean to "drive the loop"? Is that some standard vocabulary? Why is calling shark.start "driving" the loop?

This is some weird vocab claude used when I asked it to write the comment and description. I have rewritten the description to describe the exact issue without the strange terminology. What it meant was that start() calls asyncio.get_event_loop() and loop.run_until_complete().

@wojcikstefan wojcikstefan merged commit 911ae13 into master Jun 25, 2026
8 checks passed
@wojcikstefan wojcikstefan deleted the dependabot-uv-pytest-asyncio-1.4.0 branch June 25, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python:uv Pull requests that update python:uv code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants