Registry / testing / pytest-pyodide

pytest-pyodide

JSON →
library0.59.2pypypi✓ verified 87d ago

A pytest plugin for testing applications that use Pyodide (Python in the browser). Current version 0.59.1, requires Python >=3.11. Active development with frequent releases.

pip install pytest-pyodide
INSTALL
IMPORT
SIG · PYTEST-PYODIDE
P
pytest-pyodide
testingpythonv0.59.2
Install
7.2s avg
Import
578ms
Disk
212MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.58.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 7.8s
py 3.11
✕ build_error
✓ 7.3s
py 3.12
✕ build_error
✓ 6.8s
py 3.13
✕ build_error
✓ 7s
py 3.9
✕ build_error
✕ build_error
212MB installed
● package 212MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

run_in_pyodide
from pytest_pyodide import run_in_pyodide
from pytest_pyodide.decorator import run_in_pyodide
Import path changed; decorator module was flattened.

Minimal test using run_in_pyodide decorator.

import pytest from pytest_pyodide import run_in_pyodide @run_in_pyodide(packages=['numpy']) def test_numpy_in_browser(selenium): import numpy as np assert np.array([1,2,3]).sum() == 6
Debug
Known issues
breakingClassic web worker support dropped in 0.59.0. Tests must target modern browsers (Chrome/Firefox) via Selenium or Playwright.
fix
Use selenium fixture or switch to Playwright driver.
affects: >=0.59.0
deprecatedThe 'selenium' fixture is deprecated in favor of browser-agnostic fixtures. Use 'webdriver' or 'playwright_browser' instead.
fix
Replace 'selenium' with 'webdriver' or configure Playwright.
affects: >=0.58.0
gotchaPackages must be listed explicitly in @run_in_pyodide or added via conftest.py's pyodide_packages hook. Standard library modules like json, math are always available.
fix
Add required packages in the decorator: @run_in_pyodide(packages=['numpy', 'pandas'])
affects: all
gotchaTests run in a separate browser process; global state is not shared between tests. Each test receives a fresh Pyodide environment.
fix
Use fixtures to set up shared state explicitly.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pytest_pyodide'
pytest-pyodide not installed or installed in wrong environment.
fix
Ensure you are in the correct Python environment and run: pip install pytest-pyodide
Fixture 'selenium' not found
Selenium driver is not installed or the fixture has been renamed.
fix
Install selenium (pip install selenium) or use the Playwright driver: pip install playwright && playwright install
ValueError: Package 'pandas' is not loaded. Did you include it in the decorator?
Third-party packages must be explicitly listed in the run_in_pyodide decorator's packages argument.
fix
Change decorator to @run_in_pyodide(packages=['pandas'])
Upgrade
Version history
0.59.2latest on PyPI · released Apr 27, 2026
Audit
Dependencies
pytestrequiredRequired test framework
pyodide-pyrequiredPyodide runtime
playwrightoptionalBrowser automation for testing
Agent activity
4 hits · last 30 days
node
4
Resources
pytest-pyodide — pip install pytest-pyodide · libregistry