Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.x: Fix control comm channel test #3314

Merged
merged 2 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
python -m pip install jupyter_packaging
- name: Build the extension
run: |
pip install .
pip install -e .[test]
jlpm install
jlpm run build
cd jupyterlab_widgets
Expand All @@ -57,3 +57,5 @@ jobs:
jupyter labextension list

python -m jupyterlab.browser_check
- name: Run Python tests
run: pytest .
10 changes: 8 additions & 2 deletions ipywidgets/widgets/tests/test_send_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from ..widget import Widget

from ..._version import __control_protocol_version__

# A widget with simple traits
class SimpleWidget(Widget):
a = Bool().tag(sync=True)
Expand All @@ -29,6 +31,10 @@ def test_control():
comm = DummyComm()
Widget.close_all()
w = SimpleWidget()
Widget.handle_control_comm_opened(comm, {})
Widget.handle_control_comm_msg({'type': 'models-request'})
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
2 changes: 1 addition & 1 deletion ipywidgets/widgets/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def _handle_control_comm_msg(cls, msg):
), buffers=buffers)

else:
self.log.error('Unknown front-end to back-end widget control msg with method "%s"' % method)
raise RuntimeError('Unknown front-end to back-end widget control msg with method "%s"' % method)

@staticmethod
def handle_comm_opened(comm, msg):
Expand Down