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.34.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

pytest_ipywidgets-1.34.0-py2.py3-none-any.whl (4.3 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pytest_ipywidgets-1.34.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pytest_ipywidgets-1.34.0.tar.gz
Algorithm Hash digest
SHA256 960435ca599a105ff4d76812c08f46b2efc48b140a755d93c582b5d00a98de9b
MD5 b750654c7f0503ecf5fc2fe3776e4c9a
BLAKE2b-256 5bd3985cb6e7075fdc62b7f64bf740f1dcf9fbc0a5aaef4effd90c20c10c96c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytest_ipywidgets-1.34.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bbc4b794245467f4b7d3e763da5052876dbc1de2aa119501b2e3203a18336b1f
MD5 22c5b7aa4a695d2326080b302c72c50f
BLAKE2b-256 b5bfa683d80e37bb1a8d1b8bf37e6e87e07c71c6d46d110b146b37fd0bba6722

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