##// END OF EJS Templates
Backport PR #8129: Catch interrupted poll() in terminal console...
Backport PR #8129: Catch interrupted poll() in terminal console Alternative to my own PR #8108 - catch ZMQError in run_cell, and if it's caused by an interrupt, ignore it. #8108 catches the exception in the blocking kernel client API, which is more complex, especially if we want to handle the timeout nicely as proposed in the comments, but it's possibly also more convenient for other users of that API. Or perhaps not - I'm not sure what makes sense for other API consumers in this case. Fixes gh-8105

File last commit:

r18605:9867311c
r20883:0d9a347c
Show More
base.py
41 lines | 1.5 KiB | text/x-python | PythonLexer
MinRK
update nbconvert to nbformat 4
r18580 """utility functions for preprocessor tests"""
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
MinRK
update nbconvert to nbformat 4
r18580 # Copyright (c) IPython Development Team.
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023 # Distributed under the terms of the Modified BSD License.
MinRK
Don't use nbformat.current in nbconvert
r18605 from IPython.nbformat import v4 as nbformat
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
Jonathan Frederic
Added utility function to build a proper resources dict
r12031 from ...tests.base import TestsBase
from ...exporters.exporter import ResourcesDict
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 class PreprocessorTestsBase(TestsBase):
"""Contains test functions preprocessor tests"""
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
def build_notebook(self):
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 """Build a notebook in memory for use with preprocessor tests"""
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
MinRK
address review from takluyver...
r18602 outputs = [
nbformat.new_output("stream", name="stdout", text="a"),
nbformat.new_output("display_data", data={'text/plain': 'b'}),
nbformat.new_output("stream", name="stdout", text="c"),
nbformat.new_output("stream", name="stdout", text="d"),
nbformat.new_output("stream", name="stderr", text="e"),
nbformat.new_output("stream", name="stderr", text="f"),
nbformat.new_output("display_data", data={'image/png': 'Zw=='}), # g
nbformat.new_output("display_data", data={'application/pdf': 'aA=='}), # h
]
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
MinRK
s/prompt_number/execution_count in nbformat 4
r18587 cells=[nbformat.new_code_cell(source="$ e $", execution_count=1, outputs=outputs),
MinRK
update nbconvert to nbformat 4
r18580 nbformat.new_markdown_cell(source="$ e $")]
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
MinRK
update nbconvert to nbformat 4
r18580 return nbformat.new_notebook(cells=cells)
Jonathan Frederic
Added utility function to build a proper resources dict
r12031
def build_resources(self):
"""Build an empty resources dictionary."""
res = ResourcesDict()
res['metadata'] = ResourcesDict()
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 return res