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
File details
Details for the file pytest_ipywidgets-1.41.0.tar.gz
.
File metadata
- Download URL: pytest_ipywidgets-1.41.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2a9d2d5a827b109c5caea4ec0ebe9d8d9121fd6d9a38e67ba337d69ad8a2a46 |
|
MD5 | 9f0f2309ba8afbc7c35c888a9d637f38 |
|
BLAKE2b-256 | 8665bac4a65fdd620d8f827beb3b6403c8f80061553e8973195dcca249233c5c |
File details
Details for the file pytest_ipywidgets-1.41.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pytest_ipywidgets-1.41.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 025f25f5b689bb22688d854cde7ff4765f79f01e88c33d7f0a9f902f69a6ab5f |
|
MD5 | 12003836f8b1cdb1a65ae81ca6a26254 |
|
BLAKE2b-256 | 0019ab19e5cefe5c31c02a1e59616f992c5051da9df78b42ff7d94b9e3faa9c7 |