pytest-dev / pytest-dev/pytest-asyncio

Pyodide compatibility?

Open
#1,333 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
207
Avg merge
5h 35m
Merged PRs (30d)
9

Description

Would you be willing to accept patches to make this package work with Pyodide? Before version 1.2.0, it worked with Pyodide but from version 1.2.0 it fails with

RuntimeError: Runner.run() cannot be called from a running event loop

I'm not sure if this is better fixed in Pyodide or pytest-asyncio, probably it's better to fix in Pyodide. I think the cause of the issue is that Pyodide's WebLoop event loop doesn't handle lifecycle events. For instance, stop() is a no op. This is because our event loop schedules events on the JavaScript event loop and we have no control over the JavaScript event loop. But perhaps we can fake lifecycle events well enough to satisfy pytest-asyncio's needs.

Anyways if there is any interest it would be nice to add Pyodide to pytest-asyncio's CI once we get this working.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the RuntimeError with pytest-asyncio 1.2.0 under Pyodide, then inspect how Runner.run() interacts with Pyodide's WebLoop lifecycle methods, especially stop(). Determine whether the compatibility change belongs in Pyodide or pytest-asyncio. Done means the package works under Pyodide and Pyodide coverage can be added to CI.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.