diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40d39c4f6..8f92bafb8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,7 +93,7 @@ jobs: PYGFX_EXPECT_LAVAPIPE: true run: | pytest -v examples - pytest --nbmake examples/notebooks/ + FASTPLOTLIB_NB_TESTS=1 pytest --nbmake examples/notebooks/ - uses: actions/upload-artifact@v3 if: ${{ failure() }} with: diff --git a/examples/notebooks/nb_test_utils.py b/examples/notebooks/nb_test_utils.py index e16ed2eaf..71d2d5114 100644 --- a/examples/notebooks/nb_test_utils.py +++ b/examples/notebooks/nb_test_utils.py @@ -21,7 +21,19 @@ FAILURES = list() +def _run_tests(): + if "FASTPLOTLIB_NB_TESTS" not in os.environ.keys(): + return False + + if os.environ["FASTPLOTLIB_NB_TESTS"] == "1": + return True + + return False + + def plot_test(name, plot: Union[Plot, GridPlot]): + if not _run_tests(): + return snapshot = plot.canvas.snapshot() if "REGENERATE_SCREENSHOTS" in os.environ.keys(): @@ -81,6 +93,9 @@ def get_diffs_rgba(slicer): def notebook_finished(): + if not _run_tests(): + return + if len(FAILURES) > 0: raise AssertionError( f"Failures for plots:\n{FAILURES}"