{"id":21808,"library":"pytest-pyodide","title":"pytest-pyodide","description":"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.","status":"active","version":"0.59.1","language":"python","source_language":"en","source_url":"https://github.com/pyodide/pytest-pyodide","tags":["pytest","pyodide","webassembly","testing","browser"],"install":[{"cmd":"pip install pytest-pyodide","lang":"bash","label":"pip"}],"dependencies":[{"reason":"Required test framework","package":"pytest","optional":false},{"reason":"Pyodide runtime","package":"pyodide-py","optional":false},{"reason":"Browser automation for testing","package":"playwright","optional":true}],"imports":[{"note":"Import path changed; decorator module was flattened.","wrong":"from pytest_pyodide.decorator import run_in_pyodide","symbol":"run_in_pyodide","correct":"from pytest_pyodide import run_in_pyodide"}],"quickstart":{"code":"import pytest\nfrom pytest_pyodide import run_in_pyodide\n\n@run_in_pyodide(packages=['numpy'])\ndef test_numpy_in_browser(selenium):\n    import numpy as np\n    assert np.array([1,2,3]).sum() == 6\n","lang":"python","description":"Minimal test using run_in_pyodide decorator."},"warnings":[{"fix":"Use selenium fixture or switch to Playwright driver.","message":"Classic web worker support dropped in 0.59.0. Tests must target modern browsers (Chrome/Firefox) via Selenium or Playwright.","severity":"breaking","affected_versions":">=0.59.0"},{"fix":"Replace 'selenium' with 'webdriver' or configure Playwright.","message":"The 'selenium' fixture is deprecated in favor of browser-agnostic fixtures. Use 'webdriver' or 'playwright_browser' instead.","severity":"deprecated","affected_versions":">=0.58.0"},{"fix":"Add required packages in the decorator: @run_in_pyodide(packages=['numpy', 'pandas'])","message":"Packages 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Use fixtures to set up shared state explicitly.","message":"Tests run in a separate browser process; global state is not shared between tests. Each test receives a fresh Pyodide environment.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Ensure you are in the correct Python environment and run: pip install pytest-pyodide","cause":"pytest-pyodide not installed or installed in wrong environment.","error":"ModuleNotFoundError: No module named 'pytest_pyodide'"},{"fix":"Install selenium (pip install selenium) or use the Playwright driver: pip install playwright && playwright install","cause":"Selenium driver is not installed or the fixture has been renamed.","error":"Fixture 'selenium' not found"},{"fix":"Change decorator to @run_in_pyodide(packages=['pandas'])","cause":"Third-party packages must be explicitly listed in the run_in_pyodide decorator's packages argument.","error":"ValueError: Package 'pandas' is not loaded. Did you include it in the decorator?"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}