Many scientific computing projects involve code in notebooks, either to produce results or to demonstrate and explain the use of a software package. But how do you ensure that your notebooks still work as the libraries they import and call change? nbval is a plugin for the pytest testing framework which runs your notebooks as part of your test suite, so that unexpected errors will show up as test failures. You can also use nbval to check that key pieces of the produced outputs match those saved in the notebook file, to be sure that the code is still doing the same thing. This ability to automatically test notebooks with nbval enables notebooks to be a part of verifying a reproducible scientific publication.