Last active
September 24, 2023 14:54
-
-
Save SergiyKolesnikov/f94d91b947051ab5d2ba1aa30e25f050 to your computer and use it in GitHub Desktop.
Testing and Debugging Jupyter Notebooks
I'm not claiming the following is minimal or Pythonic, but I can say that it does what I wanted to have happen in my Jupyter notebook:
testSuite = unittest.TestLoader().loadTestsFromName("__main__.TestNotebook")
testRunner = unittest.TextTestRunner(verbosity=2)
testRunner.run(testSuite)
Hi, is there any similar trick to use pytest
within a notebook, without resorting to extra-dependencies such as ipytest
?
Hi, is there any similar trick to use pytest within a notebook, without resorting to extra-dependencies such as ipytest?
Unfortunately, I do not know a trick like that. I have researched this some time ago and the only two options that I found were either using an Jupyter extension or exporting the notebook to a Python file.
Thanks. I opened a feature request on pytest, let's see what happens with no success.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very helpful. I'm also looking around for the goop that would only execute the tests for the class TestNotebook. There might be others discovered from elsewhere that we don't want to execute in the present cell.