"Pytest plugin for testing Pyodide and third-party applications that use Pyodide"
Project description
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
-
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/
-
You can then use the provided fixtures (
selenium
,selenium_standalone
) in tests,def test_a(selenium): selenium.run("assert 1+1 == 2") # run Python with Pyodide
which you can run with
pytest --dist-dir=./dist/
-
For convenience, the
run_in_pyodide
decorator is also provided. For instance the above example would be equivalent to,from pytest_pyodide 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pytest_pyodide-0.21.0a8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5065c13fa32e2b44518b15d740d63fdc0b88201b95e947292ff054a5109db949 |
|
MD5 | 66446fea8ecb98a6a157b6d2d89b9504 |
|
BLAKE2b-256 | b5da93fb58d1c8c30ab077096ebca4945b356ad97c7a77a0514f8f8427c1cfad |