diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3a1a5121c9..5881c64da3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,7 +36,8 @@ jobs: python -m sphinx -T -E -b html -d ../build/doctrees -D language=en . ../build/html js: name: JavaScript - runs-on: ubuntu-latest + # as of #3653 ubuntu-latest wasn't working + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 @@ -50,7 +51,6 @@ jobs: **/requirements*.txt - name: Install dependencies run: | - sudo apt-get install -y firefox python -m pip install --upgrade pip python -m pip install jupyterlab~=3.0 - name: Install node diff --git a/python/ipywidgets/ipywidgets/widgets/tests/test_send_state.py b/python/ipywidgets/ipywidgets/widgets/tests/test_send_state.py index a39252319e..ec18ae4af1 100644 --- a/python/ipywidgets/ipywidgets/widgets/tests/test_send_state.py +++ b/python/ipywidgets/ipywidgets/widgets/tests/test_send_state.py @@ -12,29 +12,20 @@ # A widget with simple traits class SimpleWidget(Widget): a = Bool().tag(sync=True) - b = Tuple(Bool(), Bool(), Bool(), default_value=(False, False, False)).tag(sync=True) + b = Tuple(Bool(), Bool(), Bool(), default_value=(False, False, False)).tag( + sync=True + ) c = List(Bool()).tag(sync=True) + def test_empty_send_state(): w = SimpleWidget() w.send_state([]) assert w.comm.messages == [] + def test_empty_hold_sync(): w = SimpleWidget() with w.hold_sync(): pass assert w.comm.messages == [] - - -def test_control(): - comm = DummyComm() - Widget.close_all() - w = SimpleWidget() - Widget.handle_control_comm_opened( - comm, dict(metadata={'version': __control_protocol_version__}) - ) - Widget._handle_control_comm_msg(dict(content=dict( - data={'method': 'request_states'} - ))) - assert comm.messages diff --git a/python/ipywidgets/ipywidgets/widgets/tests/test_widget.py b/python/ipywidgets/ipywidgets/widgets/tests/test_widget.py index 065aa1fc67..7f7425a9b9 100644 --- a/python/ipywidgets/ipywidgets/widgets/tests/test_widget.py +++ b/python/ipywidgets/ipywidgets/widgets/tests/test_widget.py @@ -3,16 +3,18 @@ """Test Widget.""" +import inspect + +import pytest from IPython.core.interactiveshell import InteractiveShell from IPython.display import display from IPython.utils.capture import capture_output -import inspect -import pytest from .. import widget from ..widget import Widget from ..widget_button import Button + def test_no_widget_view(): # ensure IPython shell is instantiated # otherwise display() just calls print @@ -24,10 +26,12 @@ def test_no_widget_view(): assert len(cap.outputs) == 1, "expect 1 output" mime_bundle = cap.outputs[0].data - assert mime_bundle['text/plain'] == repr(w), "expected plain text output" - assert 'application/vnd.jupyter.widget-view+json' not in mime_bundle, "widget has no view" - assert cap.stdout == '', repr(cap.stdout) - assert cap.stderr == '', repr(cap.stderr) + assert mime_bundle["text/plain"] == repr(w), "expected plain text output" + assert ( + "application/vnd.jupyter.widget-view+json" not in mime_bundle + ), "widget has no view" + assert cap.stdout == "", repr(cap.stdout) + assert cap.stderr == "", repr(cap.stderr) def test_widget_view(): @@ -41,10 +45,12 @@ def test_widget_view(): assert len(cap.outputs) == 1, "expect 1 output" mime_bundle = cap.outputs[0].data - assert mime_bundle['text/plain'] == repr(w), "expected plain text output" - assert 'application/vnd.jupyter.widget-view+json' in mime_bundle, "widget should have have a view" - assert cap.stdout == '', repr(cap.stdout) - assert cap.stderr == '', repr(cap.stderr) + assert mime_bundle["text/plain"] == repr(w), "expected plain text output" + assert ( + "application/vnd.jupyter.widget-view+json" in mime_bundle + ), "widget should have have a view" + assert cap.stdout == "", repr(cap.stdout) + assert cap.stderr == "", repr(cap.stderr) def test_close_all(): diff --git a/python/ipywidgets/ipywidgets/widgets/widget.py b/python/ipywidgets/ipywidgets/widgets/widget.py index 4f4dcb3732..030fdc45ce 100644 --- a/python/ipywidgets/ipywidgets/widgets/widget.py +++ b/python/ipywidgets/ipywidgets/widgets/widget.py @@ -418,7 +418,7 @@ def handle_comm_opened(comm, msg): state = data['state'] # Find the widget class to instantiate in the registered widgets - widget_class = register.get(state['_model_module'], + widget_class = _registry.get(state['_model_module'], state['_model_module_version'], state['_model_name'], state['_view_module'],