def test_no_errors_or_warnings_in_output(notebook):
with open(notebook) as fp:
nb = nbformat.read(fp, nbformat.NO_CONVERT)
for cell in nb.cells:
if cell.cell_type == "code":
for output in cell.outputs:
if "name" in output and output["name"] == "stderr":
raise AssertionError(output["text"])
something like this: