Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_ipywidgets-1.31.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

pytest_ipywidgets-1.31.0-py2.py3-none-any.whl (4.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pytest_ipywidgets-1.31.0.tar.gz.

File metadata

  • Download URL: pytest_ipywidgets-1.31.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.26.0

File hashes

Hashes for pytest_ipywidgets-1.31.0.tar.gz
Algorithm Hash digest
SHA256 63b7eb19ac4e6c4cb1a8b26dda4ce980f49b5646e131437054e8d517d7abb6c0
MD5 44222e2e8f2c92277cc299fb4476d7c6
BLAKE2b-256 237d8650cbc2d2972da4e6dc5b6c1639c4e7fae673ca6f15acaacf95d58cf924

See more details on using hashes here.

File details

Details for the file pytest_ipywidgets-1.31.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_ipywidgets-1.31.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 35eaf4341ca80a90c84d470512daef167ef3770291822a4ed6fd75c0b141acfa
MD5 b964c8191b0173b7728994d5aaea6760
BLAKE2b-256 4953a554a0cb0e0b9dd12d4297c2f6fa67b6c8c9f85161b22579066b0b6f16ad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page