No project description provided
Project description
Test ipywidgets with playwright and pytest.
Installation
pip install "pytest-ipywidgets[all]"
(Note that the optional [all]
installs all dependencies, including compatible versions of notebook, jupyterlab and voila.)
Usage
Using solara-server (in-process)
If you want to test your ipywidgets with playwright in-process, you can use the solara_test
fixture, use display
to
show your widget in the browser.
import ipywidgets as widgets
import playwright.sync_api
from IPython.display import display
def test_widget_button_solara(solara_test, page_session: playwright.sync_api.Page):
# this all runs in-process
button = widgets.Button(description="Click Me!")
def change_description(obj):
button.description = "Tested event"
button.on_click(change_description)
display(button)
button_sel = page_session.locator("text=Click Me!")
button_sel.wait_for()
button_sel.click()
page_session.locator("text=Tested event").wait_for()
Testing in the main Jupyter Environments (Notebook, Lab, Voila & Solara)
See https://solara.dev/documentation/advanced/howto/testing for more information.
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
Close
Hashes for pytest_ipywidgets-1.35.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80d56be2b06f91bad6422e8e61cb02af6ac50c0feae460a2060bb8b4f925e782 |
|
MD5 | 7ffde2d4eab368c6967d3e5207e1e779 |
|
BLAKE2b-256 | 3321f3147d9206b4a5471c9df50ec6f8069cf9d46555f0bfa049ffcd03de6907 |