Also our Google Summer of Code project in nteract had it’s first initial release for testing notebooks: https://test-book.readthedocs.io/en/latest/. It treats ipynb files as py files for testing purposes. Try it out, @rohitsanj is looking for early users to get feedback on the library.
Given a code cell in a Jupyter Notebook:
def func(a, b):
return a + b
You can write a unit test using testbook in a Python file as follows:
import testbook
@testbook.testbook('/path/to/notebook.ipynb', execute=True)
def test_func(tb):
func = tb.ref("func")
assert func(1, 2) == 3