Registry / testing / pytest-ipywidgets

pytest-ipywidgets

JSON →
library1.57.4pypypiunverified

pytest-ipywidgets is a pytest plugin for testing Jupyter interactive widgets (ipywidgets). It provides fixtures to render widgets in a virtual output and simulate interactions. The latest version is 1.57.4, with a monthly release cadence.

pip install pytest-ipywidgets
INSTALL
IMPORT
SIG · PYTEST-IPYWIDGETS
P
pytest-ipywidgets
testingpythonv1.57.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ipywidgets_widget_factory
from pytest_ipywidgets import ipywidgets_widget_factory
from pytest_ipywidgets import fixture
The fixture is named ipywidgets_widget_factory, not fixture.

Create a widget and verify its attributes using the ipywidgets_widget_factory fixture.

import ipywidgets as widgets from pytest_ipywidgets import ipywidgets_widget_factory def test_button(ipywidgets_widget_factory): button = ipywidgets_widget_factory(widgets.Button, description='Click me') assert button.description == 'Click me'
Debug
Known issues
gotchaThe fixture `ipywidgets_widget_factory` must be a parameter in your test function; it is not imported as a standalone function. Attempting to call it directly without fixture injection will raise a fixture lookup error.
fix
Ensure the fixture name is passed as a parameter to the test function.
affects: all
deprecatedThe `widget` fixture from older versions (<1.0) has been replaced by `ipywidgets_widget_factory`. Using the old name will raise a fixture not found error.
fix
Update test functions to use `ipywidgets_widget_factory` instead of `widget`.
affects: <1.0
gotchaThe `ipywidgets_widget_factory` fixture does not support all ipywidgets traits (e.g., layout, style) in versions prior to 1.5. If you need to test layout properties, upgrade to >=1.5.
fix
Upgrade to pytest-ipywidgets>=1.5 to fully support layout and style traits.
affects: <1.5
Upgrade
Version history
1.57.4latest on PyPI · released May 14, 2026
Audit
Dependencies
pytestrequiredCore dependency for running tests
ipywidgetsrequiredWidgets to test
jupyterlaboptionalOptional: for testing in JupyterLab environment
Agent activity
6 hits · last 30 days
node
6
Resources

No resource links recorded.

pytest-ipywidgets — pip install pytest-ipywidgets · libregistry