Skip to content

Commit 60cf919

Browse files
authored
FASTPLOTLIB_NB_TESTS required for nb test funcs to run (#460)
1 parent 0021652 commit 60cf919

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
PYGFX_EXPECT_LAVAPIPE: true
9494
run: |
9595
pytest -v examples
96-
pytest --nbmake examples/notebooks/
96+
FASTPLOTLIB_NB_TESTS=1 pytest --nbmake examples/notebooks/
9797
- uses: actions/upload-artifact@v3
9898
if: ${{ failure() }}
9999
with:

examples/notebooks/nb_test_utils.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,19 @@
2121
FAILURES = list()
2222

2323

24+
def _run_tests():
25+
if "FASTPLOTLIB_NB_TESTS" not in os.environ.keys():
26+
return False
27+
28+
if os.environ["FASTPLOTLIB_NB_TESTS"] == "1":
29+
return True
30+
31+
return False
32+
33+
2434
def plot_test(name, plot: Union[Plot, GridPlot]):
35+
if not _run_tests():
36+
return
2537
snapshot = plot.canvas.snapshot()
2638

2739
if "REGENERATE_SCREENSHOTS" in os.environ.keys():
@@ -81,6 +93,9 @@ def get_diffs_rgba(slicer):
8193

8294

8395
def notebook_finished():
96+
if not _run_tests():
97+
return
98+
8499
if len(FAILURES) > 0:
85100
raise AssertionError(
86101
f"Failures for plots:\n{FAILURES}"

0 commit comments

Comments
 (0)