Reset an IPython kernel without restarting
<p>Is there a way of <strong>programmatically</strong> reset an IPython kernel without restarting it?</p>

<p>Currently I am calling <code>KernelManager.restart_kernel</code> but that is quite slow. </p>

<p>The purpose of this is to isolate unit tests in a <code>py.test</code> plugin for using Notebook cells as unit tests. If you have other ideas to achieve this I'd love suggestions. The code is here:</p>

<p><a href="https://github.com/zonca/pytest-ipynb/blob/master/pytest_ipynb/plugin.py#L100" rel="nofollow">https://github.com/zonca/pytest-ipynb/blob/master/pytest_ipynb/plugin.py#L100</a> </p>