Skip to content

simplify screenshot testing #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 86 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,13 @@ jobs:
make html SPHINXOPTS="-W --keep-going"

test-build-full:
name: Test examples, env with notebook and glfw
name: Test Linux, notebook + glfw
runs-on: bigmem
if: ${{ !github.event.pull_request.draft }}
strategy:
fail-fast: false
matrix:
include:
- name: Test py39
pyversion: '3.9'
- name: Test py310
pyversion: '3.10'
- name: Test py311
Expand Down Expand Up @@ -103,15 +101,13 @@ jobs:
examples/notebooks/diffs

test-build-desktop:
name: Test examples, env with only glfw
name: Test Linux, only glfw
runs-on: bigmem
if: ${{ !github.event.pull_request.draft }}
strategy:
fail-fast: false
matrix:
include:
- name: Test py39
pyversion: '3.9'
- name: Test py310
pyversion: '3.10'
- name: Test py311
Expand Down Expand Up @@ -156,3 +152,87 @@ jobs:
name: screenshot-diffs
path: |
examples/desktop/diffs

# test-build-full-mac:
# name: Test Mac, notebook + glfw
# runs-on: macos-14
# if: ${{ !github.event.pull_request.draft }}
# strategy:
# fail-fast: false
# matrix:
# include:
# - name: Test py310
# pyversion: '3.10'
# - name: Test py311
# pyversion: '3.11'
# - name: Test py312
# pyversion: '3.12'
# steps:
# - uses: actions/checkout@v3
# with:
# lfs: true
# - name: Set up Python
# uses: actions/setup-python@v3
# with:
# python-version: ${{ matrix.pyversion }}
# - name: Install dev dependencies
# run: |
# python -m pip install --upgrade pip setuptools
# # remove pygfx from install_requires, we install using pygfx@main
# pip install -e ".["tests"]"
# pip install git+https://github.com/pygfx/pygfx.git@main
# - name: Show wgpu backend
# run:
# python -c "from examples.tests.testutils import wgpu_backend; print(wgpu_backend)"
# - name: Test examples
# run: |
# pytest -v examples
# pytest --nbmake examples/notebooks/
# - uses: actions/upload-artifact@v3
# if: ${{ failure() }}
# with:
# name: screenshot-diffs
# path: |
# examples/desktop/diffs
# examples/notebooks/diffs
#
# test-build-glfw-mac:
# name: Test Mac, glfw
# runs-on: macos-14
# if: ${{ !github.event.pull_request.draft }}
# strategy:
# fail-fast: false
# matrix:
# include:
# - name: Test py310
# pyversion: '3.10'
# - name: Test py311
# pyversion: '3.11'
# - name: Test py312
# pyversion: '3.12'
# steps:
# - uses: actions/checkout@v3
# with:
# lfs: true
# - name: Set up Python
# uses: actions/setup-python@v3
# with:
# python-version: ${{ matrix.pyversion }}
# - name: Install dev dependencies
# run: |
# python -m pip install --upgrade pip setuptools
# # remove pygfx from install_requires, we install using pygfx@main
# pip install -e ".["tests-desktop"]"
# pip install git+https://github.com/pygfx/pygfx.git@main
# - name: Show wgpu backend
# run:
# python -c "from examples.tests.testutils import wgpu_backend; print(wgpu_backend)"
# - name: Test examples
# run: |
# pytest -v examples
# - uses: actions/upload-artifact@v3
# if: ${{ failure() }}
# with:
# name: screenshot-diffs
# path: |
# examples/desktop/diffs
2 changes: 1 addition & 1 deletion .github/workflows/screenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: |
# regenerate screenshots
REGENERATE_SCREENSHOTS=1 pytest -v examples
REGENERATE_SCREENSHOTS=1 pytest --nbmake examples/notebooks/
FASTPLOTLIB_NB_TESTS=1 REGENERATE_SCREENSHOTS=1 pytest --nbmake examples/notebooks/
- uses: actions/upload-artifact@v3
if: always()
with:
Expand Down
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/gridplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/gridplot_non_square.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/heatmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/heatmap_cmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/heatmap_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/heatmap_vmin_vmax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/image_cmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/image_rgb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/image_rgbvminvmax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/image_simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/image_vminvmax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/line_cmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/line_collection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/line_collection_colors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/line_colorslice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/line_dataslice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/line_present_scaling.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/line_stack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/scatter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/scatter_cmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/scatter_colorslice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/scatter_dataslice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/scatter_present.png
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/scatter_size.png
25 changes: 21 additions & 4 deletions examples/notebooks/image_widget_test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"metadata": {},
"outputs": [],
"source": [
"from nb_test_utils import plot_test, notebook_finished "
"from nb_test_utils import plot_test, notebook_finished\n",
"import nb_test_utils\n",
"nb_test_utils.TOLERANCE = 0.035"
]
},
{
Expand Down Expand Up @@ -57,7 +59,8 @@
"source": [
"iw = ImageWidget(\n",
" data=a,\n",
" cmap=\"viridis\"\n",
" cmap=\"viridis\",\n",
" grid_plot_kwargs={\"size\": (900, 600)},\n",
")"
]
},
Expand Down Expand Up @@ -128,7 +131,8 @@
"iw_movie = ImageWidget(\n",
" data=gray_movie, \n",
" slider_dims=[\"t\"],\n",
" cmap=\"gray\"\n",
" cmap=\"gray\",\n",
" grid_plot_kwargs={\"size\": (900, 600)},\n",
")"
]
},
Expand Down Expand Up @@ -271,6 +275,9 @@
"execution_count": null,
"id": "76535d56-e514-4c16-aa48-a6359f8019d5",
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": []
},
"outputs": [],
Expand All @@ -280,6 +287,7 @@
" window_funcs={\"t\": (np.mean, 5)},\n",
" names=[f\"plane-{i}\" for i in range(n_planes)],\n",
" cmap=\"gnuplot2\", \n",
" grid_plot_kwargs={\"size\": (900, 600)},\n",
")"
]
},
Expand Down Expand Up @@ -379,6 +387,7 @@
" data=zfish_data, # you can also provide a list of tzxy arrays\n",
" window_funcs={\"t\": (np.mean, 5)},\n",
" cmap=\"gnuplot2\", \n",
" grid_plot_kwargs={\"size\": (900, 600)},\n",
")"
]
},
Expand Down Expand Up @@ -444,6 +453,14 @@
"source": [
"notebook_finished()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b8fff1a6-119e-4f03-ba3a-4c7b9e8c212b",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -462,7 +479,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.11.3"
}
},
"nbformat": 4,
Expand Down
Loading