Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR] Fix async tests with no explicit event_loop usage/declaration #352

Closed
5 tasks done
kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Closed
5 tasks done

[PR] Fix async tests with no explicit event_loop usage/declaration #352

kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Labels
archive automation CI/CD: testing, linting, releasing automatically

Comments

@kopf-archiver
Copy link

kopf-archiver bot commented Aug 18, 2020

A pull request by nolar at 2020-04-27 22:03:12+00:00
Original URL: zalando-incubator/kopf#352
Merged by nolar at 2020-04-28 08:09:26+00:00

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

Issues: #273

Related: #13

Type of changes

  • Mostly CI/CD automation, contribution experience

Checklist

  • The code addresses only the mentioned problem, and this problem only
  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
@kopf-archiver kopf-archiver bot closed this as completed Aug 18, 2020
nolar added a commit that referenced this issue Aug 18, 2020
Fix async tests with no explicit `event_loop` usage/declaration
@kopf-archiver kopf-archiver bot changed the title [archival placeholder] [PR] Fix async tests with no explicit event_loop usage/declaration Aug 19, 2020
@kopf-archiver kopf-archiver bot added the automation CI/CD: testing, linting, releasing automatically label Aug 19, 2020
@nolar nolar mentioned this issue Sep 6, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archive automation CI/CD: testing, linting, releasing automatically
Projects
None yet
Development

No branches or pull requests

0 participants