box / flaky

Plugin for nose or pytest that automatically reruns flaky tests.
Apache License 2.0
377 stars 60 forks source link

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

Open dimaqq opened 4 years ago

dimaqq commented 4 years ago

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

heliping commented 3 years ago

any updates? need to use flaky with pyppeteer to test web UI.

seifertm commented 2 years ago

@dimaqq @heliping The issue was addressed in pytest-asyncio. Can you check if the fix works for you? You'll need to install the VCS version of pytest-asyncio for that: pip install pytest-asyncio@git+https://github.com/pytest-dev/pytest-asyncio.git@master

jaredar1232 commented 2 years ago

@seifertm awesome, this appears to have fixed this issue for me. Any idea when it will be in a stable release?

seifertm commented 2 years ago

@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?

seifertm commented 2 years ago

See https://github.com/pytest-dev/pytest-asyncio/issues/248

asvetlov commented 2 years ago

pytest-asyncio 0.17 has just been released.

I guess to close the issue.

arg0d commented 2 years ago

I can confirm this is fixed when using pytest-asyncio ~= 0.18. Previously I was using pytest-asyncio ~= 0.16 and had the same error as described in this issue.

seifertm commented 10 months ago

This issue seems to have been fixed. A user reported a working integration between flaky and pytest-asyncio for v0.18.

I suppose it would be reasonable to close this issue.