When generating a notebook with autotest directives, cells that don't produce a text/plain output will cause AutoTest to crash with output:
File "/opt/conda/lib/python3.11/site-packages/jupyter_client/client.py", line 551, in _async_execute_interactive
output_hook(msg)
File "/opt/conda/lib/python3.11/site-packages/nbgrader/preprocessors/instantiatetests.py", line 430, in _execute_code_snippet_output_hook
self.execute_result = self.sanitizer(content["data"]["text/plain"])
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'text/plain'
The offending cell that was the source of the key error in my case just rendered an IRdisplay:
The fix for this should be fairly easy. When the kernel returns a response, need to check that the content dict has a text/plain entry before trying to use it. If it doesn't, then there's nothing to handle and AutoTest should move on, unless it's specifically expecting a response in which case throw an exception with a more informative error message.
When generating a notebook with autotest directives, cells that don't produce a
text/plain
output will cause AutoTest to crash with output:The offending cell that was the source of the key error in my case just rendered an
IRdisplay
:The fix for this should be fairly easy. When the kernel returns a response, need to check that the content dict has a
text/plain
entry before trying to use it. If it doesn't, then there's nothing to handle and AutoTest should move on, unless it's specifically expecting a response in which case throw an exception with a more informative error message.