Skip to content

Ui-test failure on Python 3.12 #1639

@bnavigator

Description

@bnavigator

Describe the bug
I am getting a new failure in an ui-test notebook with Python 3.12 which does not happen in previous versions

To Reproduce
pytest-3.12 -v --nbval ui-tests/tests/notebooks/index_selector_update.ipynb

Expected behavior
PASSED

Output

[  124s] =================================== FAILURES ===================================
[  124s] _________ ui-tests/tests/notebooks/index_selector_update.ipynb::Cell 0 _________
[  124s] Notebook cell execution failed
[  124s] Cell 0: Cell execution caused an exception
[  124s] 
[  124s] Input:
[  124s] from bqplot import *
[  124s] from bqplot.interacts import *
[  124s] 
[  124s] # Create Scatter
[  124s] sc_x = LinearScale()
[  124s] sc_y = LinearScale()
[  124s] 
[  124s] scatt = Scatter(
[  124s]     x=list(range(10)), 
[  124s]     y=[20, 3, 23, 5, 6, 12, 23, 14, 20, 3],
[  124s]     scales={'x': sc_x, 'y': sc_y},
[  124s]     selected_style={"opacity": "1"},
[  124s]     unselected_style={"opacity": "0.2"}
[  124s] )
[  124s] 
[  124s] sel = IndexSelector(
[  124s]     marks=[scatt], 
[  124s]     scale=sc_x,
[  124s]     selected=3
[  124s] )
[  124s] 
[  124s] ax_x = Axis(scale=sc_x)
[  124s] ax_y = Axis(scale=sc_y, orientation='vertical')
[  124s] 
[  124s] fig = Figure(
[  124s]     marks=[scatt], 
[  124s]     axes=[ax_x, ax_y],
[  124s]     interaction=sel
[  124s] )
[  124s] fig
[  124s] 
[  124s] Traceback:
[  124s] 
[  124s] ---------------------------------------------------------------------------
[  124s] TypeError                                 Traceback (most recent call last)
[  124s] Cell In[1], line 16
[  124s]       6 sc_y = LinearScale()
[  124s]       8 scatt = Scatter(
[  124s]       9     x=list(range(10)), 
[  124s]      10     y=[20, 3, 23, 5, 6, 12, 23, 14, 20, 3],
[  124s]    (...)
[  124s]      13     unselected_style={"opacity": "0.2"}
[  124s]      14 )
[  124s] ---> 16 sel = IndexSelector(
[  124s]      17     marks=[scatt], 
[  124s]      18     scale=sc_x,
[  124s]      19     selected=3
[  124s]      20 )
[  124s]      22 ax_x = Axis(scale=sc_x)
[  124s]      23 ax_y = Axis(scale=sc_y, orientation='vertical')
[  124s] 
[  124s] File /usr/lib/python3.12/site-packages/ipywidgets/widgets/widget.py:506, in Widget.__init__(self, **kwargs)
[  124s]     503 super().__init__(**kwargs)
[  124s]     505 Widget._call_widget_constructed(self)
[  124s] --> 506 self.open()
[  124s] 
[  124s] File /usr/lib/python3.12/site-packages/ipywidgets/widgets/widget.py:535, in Widget.open(self)
[  124s]     532 if self._model_id is not None:
[  124s]     533     args['comm_id'] = self._model_id
[  124s] --> 535 self.comm = comm.create_comm(**args)
[  124s] 
[  124s] File /usr/lib/python3.12/site-packages/ipywidgets/comm.py:33, in create_comm(*args, **kwargs)
[  124s]      31     return Comm(*args, **kwargs)
[  124s]      32 else:
[  124s] ---> 33     return comm.create_comm(*args, **kwargs)
[  124s] 
[  124s] File /usr/lib/python3.12/site-packages/ipykernel/ipkernel.py:51, in _create_comm(*args, **kwargs)
[  124s]      49 def _create_comm(*args, **kwargs):
[  124s]      50     """Create a new Comm."""
[  124s] ---> 51     return BaseComm(*args, **kwargs)
[  124s] 
[  124s] File /usr/lib/python3.12/site-packages/comm/base_comm.py:68, in BaseComm.__init__(self, target_name, data, metadata, buffers, comm_id, primary, target_module, topic, _open_data, _close_data, **kwargs)
[  124s]      64 self._closed = True
[  124s]      66 if self.primary:
[  124s]      67     # I am primary, open my peer.
[  124s] ---> 68     self.open(data=data, metadata=metadata, buffers=buffers)
[  124s]      69 else:
[  124s]      70     self._closed = False
[  124s] 
[  124s] File /usr/lib/python3.12/site-packages/comm/base_comm.py:106, in BaseComm.open(self, data, metadata, buffers)
[  124s]     104 comm_manager.register_comm(self)
[  124s]     105 try:
[  124s] --> 106     self.publish_msg(
[  124s]     107         "comm_open",
[  124s]     108         data=data,
[  124s]     109         metadata=metadata,
[  124s]     110         buffers=buffers,
[  124s]     111         target_name=self.target_name,
[  124s]     112         target_module=self.target_module,
[  124s]     113     )
[  124s]     114     self._closed = False
[  124s]     115 except Exception:
[  124s] 
[  124s] File /usr/lib/python3.12/site-packages/ipykernel/comm/comm.py:37, in BaseComm.publish_msg(self, msg_type, data, metadata, buffers, **keys)
[  124s]      34     self.kernel = Kernel.instance()
[  124s]      36 assert self.kernel.session is not None
[  124s] ---> 37 self.kernel.session.send(
[  124s]      38     self.kernel.iopub_socket,
[  124s]      39     msg_type,
[  124s]      40     content,
[  124s]      41     metadata=json_clean(metadata),
[  124s]      42     parent=self.kernel.get_parent(),
[  124s]      43     ident=self.topic,
[  124s]      44     buffers=buffers,
[  124s]      45 )
[  124s] 
[  124s] File /usr/lib/python3.12/site-packages/jupyter_client/session.py:854, in Session.send(self, stream, msg_or_type, content, parent, ident, buffers, track, header, metadata)
[  124s]     852 to_send = self.serialize(msg, ident)
[  124s]     853 to_send.extend(buffers)
[  124s] --> 854 longest = max([len(s) for s in to_send])
[  124s]     855 copy = longest < self.copy_threshold
[  124s]     857 if stream and buffers and track and not copy:
[  124s]     858     # only really track when we are doing zero-copy buffers
[  124s] 
[  124s] TypeError: 0-dim memory has no length
[  124s] 
[  124s] _________ ui-tests/tests/notebooks/index_selector_update.ipynb::Cell 1 _________
[  124s] Notebook cell execution failed
[  124s] Cell 1: Cell execution caused an exception
[  124s] 
[  124s] Input:
[  124s] sel.selected = 5
[  124s] 
[  124s] Traceback:
[  124s] 
[  124s] ---------------------------------------------------------------------------
[  124s] NameError                                 Traceback (most recent call last)
[  124s] Cell In[1], line 1
[  124s] ----> 1 sel.selected = 5
[  124s] 
[  124s] NameError: name 'sel' is not defined
[  124s] 
[  124s] =========================== short test summary info ============================
[  124s] FAILED ui-tests/tests/notebooks/index_selector_update.ipynb::Cell 0
[  124s] FAILED ui-tests/tests/notebooks/index_selector_update.ipynb::Cell 1
[  124s] ======================== 2 failed, 140 passed in 24.50s ========================

Additional context
The packages in the stacktrace are up to date, no idea which one is at fault

ipywidgets 8.1.1
ipykernel 6.29.2
comm 0.2.1
jupyter-client 8.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions