flaky + pytest-asyncio: RuntimeError: Event loop is closed

See original GitHub issue

Latest pytest, pytest-asyncio and flaky just can’t live happily together.

When a flaky test fails, an error RuntimeError: Event loop is closed is reported instead of failure. Edit: In fact, first test failure breaks the harness and “flaky” test is not retried.

MRE: https://github.com/dimaqq/mre-loop-closed

Edit: cross-posted to https://github.com/pytest-dev/pytest-asyncio/issues/178

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
seifertmcommented, Jan 11, 2022

@jaredar1232 I think a release in the near future would make sense, especially because of the deprecations around async fixture handling.

@Tinche @asvetlov Would it make sense to release pytest-asyncio v0.17? Or is there something that needs to be done before that?

Read more comments on GitHub >

github_iconTop Results From Across the Web

RuntimeError: Event loop is closed" when using pytest ...
I had the exact same problem. The good news is that it looks like aiohttp has a fix for this problem. The bad...
Read more >
asyncio runtimeerror event loop is closed - You.com | The AI ...
Latest pytest , pytest-asyncio and flaky just can't live happily together. When a flaky test fails, an error RuntimeError: Event loop is closed...
Read more >
mozilla-central: changeset 568432 ...
Set event loop scope to session(assuming it would reuse the same event loop for all tests) to avoid event loop is closed error...
Read more >
Pytest-asyncio: Pytest Support for Asyncio - Morioh
Creates and injects a new instance of the default asyncio event loop. By default, the loop will be closed at the end of...
Read more >
Advanced asyncio testing - Stefan Scherfke
Fixtures allow you to create a clean event loop instance for every ... import pytest @pytest.mark.asyncio async def test_coro(event_loop): ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found