qutip / qutip-notebooks

A collection of IPython notebooks using QuTiP: examples, tutorials, development test, etc.
BSD 3-Clause "New" or "Revised" License
238 stars 236 forks source link

Check Notebooks for Errors #141

Closed christian512 closed 2 years ago

christian512 commented 2 years ago

I was experimenting around with PyTests and Notebooks to automatically detect errors in the notebooks. This is my initial idea for a layout that can be extended to more Notebooks in the future. I also added small fixes to three notebooks, that I detected with this script.

review-notebook-app[bot] commented 2 years ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

christian512 commented 2 years ago

This PR also includes a github action to perform the tests automatically on any push. I am not sure if these changes are good enough for a PR, but I think it is a good start for automatic testing of the notebooks. Other notebooks can be added to the tests when they are verified to work with the current version of QuTiP.

hodgestar commented 2 years ago

@christian512 Sorry it took me so long to look at this PR properly.

I had something a bit more drastic in mind for the full GSoC project (using markdown notebooks, a new repo, adding some actual assertions, running the notebook tests in a less manual way) but this is a great proof of concept.

If you like we can perhaps remove the draft status and actually think about merging this PR. Having some tests here rather than none is a big win.

christian512 commented 2 years ago

@hodgestar , thanks for the comments :+1: Sure, for the full GSoC project I would add more infrastructure for the notebooks (which we can discuss before I start working on it).

Regarding the automatic testing: I added a GitHub Action which checks a few notebooks for errors on any push or PR. In which way would you make these tests more automatic?

hodgestar commented 2 years ago

@christian512 Re: running the tests in a less manual way, I meant using something like nbmake.

hodgestar commented 2 years ago

Thanks, @christian512. Merging!

christian512 commented 2 years ago

Thanks for the feedback, @hodgestar. I will take a look at nbmake :)