Closed romainfrancois closed 9 months ago
The trick that we inherit from IRkernel currently has to be compensated by a test trick .
def _execute_code(self, code, tests=True, silent=False, store_history=True):
self.flush_channels()
reply, output_msgs = self.execute_helper(code, silent=silent, store_history=store_history)
self.assertEqual(reply['content']['status'], 'ok', '{0}: {0}'.format(reply['content'].get('ename'), reply['content'].get('evalue')))
if tests:
self.assertGreaterEqual(len(output_msgs), 1)
# xeusr does the same as irkernel: only sends display_data, not execute_result
self.assertEqual(output_msgs[0]['msg_type'], 'display_data')
return reply, output_msgs
and redefine test_execute_result
:
def test_execute_result(self):
self.flush_channels()
reply, output_msgs = self._execute_code(code="6*7")
data = output_msgs[0]['content']['data']
self.assertEqual(data['text/plain'], ['[1] 42'])
Our execute implementation is currently based on
IRkernel
's and therefore usesdisplay
for all results, and consequently does not usepublish_execution_result()
The stock unit tests that we get from the 🍪 suggests that we do need to publish the results via
publish_execution_result()
rather than display.24 is a first attempt to look at this, it may be a problem for:
ggplot2
based graphics, which require to beprint()
ed, most often via auto print