This repository has been archived by the owner on Sep 14, 2020. It is now read-only.
Fix async tests with no explicit event_loop
usage/declaration
#352
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What do these changes do?
Fix CI/CD tests with pytest-asyncio and no explicit declaration of
event_loop
fixture (as it is not used). This only affects CI/CD and local development, not the framework itself.Blocks #350 #351 and all new PRs.
Description
Part 1: Reveals itself as async tests freezing with no reaction for long time: due to fixtures (e.g. aresponses, aiohttp server, etc) created in different event loops than the test itself.
Originally caused by pytest-asyncio upgrade from 0.10.0 to 0.11.0 (diff).
Fixed by auto-adding
asyncio
markers for all async tests even earlier than before, so that pytest-asyncio could notice them on item creation.Part 2: In that case, some tests fail due to event loop is not running when they try to create event-loop dependent objects. E.g.
aresponses
says:The object should be created from async function
.Caused by: pytest-dev/pytest-asyncio#154 (since 0.11.0). Fixed in: pytest-dev/pytest-asyncio#156 (not yet merged and released to the moment).
As an all-in-one fix, bot prepare it for pytest-asyncio==0.11.0 by fixing the freezes, but roll back to 0.10.0 (and therefore, pytest<5.4.0) for now, until the event_loop issue is resolved.
Issues/PRs
Type of changes
Checklist
CONTRIBUTORS.txt