Metadata-Version: 2.1
Name: pytest-pyodide
Version: 0.21.0a4
Summary: "Pytest plugin for testing Pyodide and third-party applications that use Pyodide"
Home-page: https://github.com/pyodide/pytest-pyodide
Author: Pyodide developers
Project-URL: Bug Tracker, https://github.com/pyodide/pytest-pyodide/issues
Project-URL: Documentation, https://pyodide.org/en/stable/
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Operating System :: OS Independent
Classifier: Framework :: Pytest
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# pytest-pyodide

![GHA](https://github.com/pyodide/pytest-pyodide/actions/workflows/main.yml/badge.svg)
[![codecov](https://codecov.io/gh/pyodide/pytest-pyodide/branch/main/graph/badge.svg?token=U7tWHpJj5c)](https://codecov.io/gh/pyodide/pytest-pyodide)


Pytest plugin for testing Pyodide and third-party applications that use Pyodide

## Installation

pytest-pyodide requires Python 3.10+ and can be installed with
```
pip install pytest-pyodide
```
You would also one at least one of the following runtimes,
 - Chrome and chromedriver
 - Firefox and geckodriver
 - node v14+

## Usage

1. First you would need a compatible version of Pyodide. You can download the Pyodide build artifacts from releases with,
   ```
   wget https://github.com/pyodide/pyodide/releases/download/0.21.0a3/pyodide-build-0.21.0a3.tar.bz2
   tar xjf pyodide-build-0.21.0a3.tar.bz2
   mv pyodide dist/
   ```

2. You can then use the provided fixtures (`selenium`, `selenium_standalone`) in tests,
   ```py
   def test_a(selenium):
       selenium.run("assert 1+1 == 2")   # run Python with Pyodide

   ```
   which you can run with
   ```bash
   pytest --dist-dir=./dist/
   ```
3. For convenience, the `run_in_pyodide` decorator is also provided. For
   instance the above example would be equivalent to,
   ```py
   from pytest_pyodide.decorator import run_in_pyodide

   @run_in_pyodide
   def test_a(selenium):
       assert 1+1 == 2
   ```

## License

pytest-pyodide uses the [Mozilla Public License Version
2.0](https://choosealicense.com/licenses/mpl-2.0/).
