Skip to content

Commit

Permalink
link to pooch cache of test images
Browse files Browse the repository at this point in the history
  • Loading branch information
bjlittle committed Oct 13, 2023
1 parent c1248df commit 7d204d2
Show file tree
Hide file tree
Showing 41 changed files with 66 additions and 9 deletions.
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ filterwarnings = [
"error",
"ignore:numpy.ndarray size changed:RuntimeWarning",
"ignore:Unable to remesh 1 cell:UserWarning",
"ignore:pyvista test cache image dir:UserWarning",
"ignore:pyvista test generated image dir:UserWarning",
]
image_cache_dir = "tests/plotting/image_cache"
markers = [
Expand Down
2 changes: 1 addition & 1 deletion src/geovista/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
BASE_URL: str = "https://github.com/bjlittle/geovista-data/raw/{version}/data/"

#: Pin to use the specific geovista-data repository version for geovista resources.
DATA_VERSION: str = "2023.08.0"
DATA_VERSION: str = "2023.10.1"

#: Environment variable to override pooch cache manager path.
ENV: str = "GEOVISTA_CACHEDIR"
Expand Down
44 changes: 40 additions & 4 deletions src/geovista/registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ mesh/lfric_c96.vtk.bz2 ba62e4c9fa4831e7617a36e763cd596e0b9eb54fbdedc76bf9fa527c7
natural_earth/physical/ne_coastlines_10m.vtk.bz2 404e2c5908f5dba71bd3bfe21e6e0295e5a5f316344e1b8c4f94774edd00d15b
natural_earth/physical/ne_coastlines_110m.vtk.bz2 c7094c14661563e6dc80bcf22556eeef31539a52c6c655bf01264527c5993f12
natural_earth/physical/ne_coastlines_50m.vtk.bz2 12f393aac2d4861770a3e584f1fbabd96e3dda3a100ab2ff6318223bdb24d90d
raster/HYP_50M_SR_W.jpg 837755a2871305b3f61d5980aee3b4b795e715bb6e7e7aa40e36b2e64aa511bd
raster/NE1_50M_SR_W.jpg 1a39003fe5fabb82a6816e79bb6bbe8215a8060d2e437b110f265ced5efdbbe7
raster/uv-checker-map-4k.png b9ad63b29f85aed2ef2a6d630028d50a63f3a9050a3f9f0b291dcb5878adf820
raster/world.topo.bathy.200412.3x5400x2700.jpg a9f0088972dee0254610af851c4d6838ca3f2cf79176987e0a5713e2c15ec042
pantry/c768/cloud_amount_high.nc.bz2 64363097a93616e29bdd98074ff02827a8404a27f1e5ebac8a6ea6a7d423f88f
pantry/c768/cloud_amount_low.nc.bz2 303e02792fa8e11e384bc373f351a2edc39c650b0dbc81f2a1d84b6b4a176329
pantry/c768/cloud_amount_medium.nc.bz2 0a869e322e5a2b2bf3a13b36044ce79fcb84e401e4e520f8b2af8e8c8871490b
Expand All @@ -31,4 +27,44 @@ pantry/votemper.nc.bz2 1ff98424be74840434a42d955ffae12d277e34014f0356fba2dd7a0eb
pantry/votemper-gradient.nc.bz2 75fe715ff45b0112375867dddbf61a01df6d0cd5e212eaea0bf05bcb1f55d1b6
pantry/ww3/ww3_gbl_tri_hs.nc.bz2 3bdd71d799bb4532bb4c2868ac64c3062dceb7c43393602f5f66664822ef97ac
pantry/ww3/ww3_gbl_smc_hs.nc.bz2 d5764f8b2461f8587d1a5946f6c650b6a59e5325ef9ce015a323f7498e8dc3d0
raster/HYP_50M_SR_W.jpg 837755a2871305b3f61d5980aee3b4b795e715bb6e7e7aa40e36b2e64aa511bd
raster/NE1_50M_SR_W.jpg 1a39003fe5fabb82a6816e79bb6bbe8215a8060d2e437b110f265ced5efdbbe7
raster/uv-checker-map-4k.png b9ad63b29f85aed2ef2a6d630028d50a63f3a9050a3f9f0b291dcb5878adf820
raster/world.topo.bathy.200412.3x5400x2700.jpg a9f0088972dee0254610af851c4d6838ca3f2cf79176987e0a5713e2c15ec042
tests/images/clouds.png 227b833d01d82b30cb9c016e3652c4b3ef4196f9368befbc2f118eeae835a714
tests/images/clouds_robin.png 9bb1883bb3899f1c7a474a1ef14eca527263d8d1a4c988d845c96be297b0117a
tests/images/earthquakes.png 995b3777e18cdaf1677a96d5a5dc0918a75e679167b9074c2841d1ffd88295b0
tests/images/earthquakes_wink1.png bb929dc99d2ea390a217929a9217fc7b1e7828639cd9a0fcc51484b342b88d6f
tests/images/from_1d__oisst_eqc.png 5e8c62933238d08baaa09eb6f12f7d5e47e731023bbe8600b75dc96c1ef21971
tests/images/from_1d__oisst.png 92da94eb490eaa72acca8938e22edacf530b43a15bd215633bb6111d5380bfba
tests/images/from_1d__synthetic_face_m1_n1.png 917dca4452ab0c2fbe1fccfe8439855f3cd1becb8b73c2424086a622d3867c62
tests/images/from_1d__synthetic_face_m1_n1_robin.png 0f5e20354da5776735b91ab0889d3beae99e5578426a1383a67408cbc103b54e
tests/images/from_1d__synthetic_node_m1_n1_moll.png e6bb80546c4131f6431736746967b155240e0ef741767aa2a8dbd88adbd0bfaa
tests/images/from_1d__synthetic_node_m1_n1.png 8ba6bf5afceb10375df4d95acf7391e5d979ac4945806091ee99928771139b2f
tests/images/from_2d__orca_moll.png 576dd061b242aa2fd55166381aed91f9068aed508ed6b832186a326523855072
tests/images/from_2d__orca.png 8552e2010bb058f190694cc7da3d096988edb30406b2d9ad1d64165eaa2f836a
tests/images/from_2d__synthetic_face_m1n1.png 9ef84bc7a41d237063f819b56a122b943e856f62f402bf16ca0d53f17284bfb9
tests/images/from_2d__synthetic_face_m1n1_robin.png 9c837e028c1ad33cc867d42f0d8e129bb932fd076476249bccb8e4abf6156225
tests/images/from_2d__synthetic_node_m1n1_moll.png d93e9907bd306b95c2e67b5ed99466f08edb3cdd35de85bb4026076422f9b5e3
tests/images/from_2d__synthetic_node_m1n1.png 9d00923e48dad39ba03d903b18a5151ffb085b98e8eba4ad0601ad8630aef5b8
tests/images/from_points__orca_cloud_eqc.png 0da4c929670685e5cdbf363ca402df9d13f7d577b0a7c9eb9ed60f53d7c2206e
tests/images/from_points__orca_cloud.png 2698626824f4a40f99f98e8bf636e4e883c31c53f3a4851d87bf31a807ab3bcf
tests/images/from_unstructured__fesom_fouc.png 8a8de06cd8f18e9758c05baf3bad77b570bca883cb7f5f2ef4f3c3164e7cfe9d
tests/images/from_unstructured__fesom.png 3a5463d807a8951072a33e0b8f9f83eedfea8ab9b41cd1a13ae4689478013e39
tests/images/from_unstructured__fvcom.png 969a121c2e2af298f5bac742634f72dddf916d2dd929a4572d6e6f89c22eacbc
tests/images/from_unstructured__icon_eqc.png 442ec422eb1069041212acee9133efa5bfd5f2f9e2b15612eb2818c93887be56
tests/images/from_unstructured__icon.png a505dafa655d08fa2ce38343a0ae860089b1733aaf818a7397dcfaebe187b917
tests/images/from_unstructured__icosahedral.png b36ac3c2150ec34fc287ec1ec49370cf31f6f3a0bc62801fb29723194e2d198a
tests/images/from_unstructured__icosahedral_poly.png 13afe9e5cd9de728c445b1e089f166353a18ce1d0e16e1ab7f71c5f13b3a3ad6
tests/images/from_unstructured__lam_pacific_moll.png aaf8a550bf37c4cb32d43c61fd6bf2aa427a5292f7e7c599392e771fac762a42
tests/images/from_unstructured__lam_pacific.png 25558c7d0ecc3333661c85aff89fea74e2420f0b5e8296b8108237cdf62f0492
tests/images/from_unstructured__lfric_orog.png 0a144ea930023718003b2e511f109111f244fbbc71e58dc5f8528477b240099a
tests/images/from_unstructured__lfric_orog_warp.png 1de1341d896af0c57f2419d76fe5e27b6c14c69b9320f2395c367e2e030aaf71
tests/images/from_unstructured__lfric_sst_bonne.png 273a3b4eedad61b690f7251eba788c092bd0d1df9ac665739637a24689c4c763
tests/images/from_unstructured__lfric_sst.png 29e1556282260a3a27faec5dd4bbe477c21bac40520e73b931dc4b0b84b299a0
tests/images/from_unstructured__smc.png 976987bcfdc25610b085efa2c538e2ff9125f0e5e3f0fa0dffe7214189e53a6a
tests/images/from_unstructured__smc_sinu.png c4e05cf1d4a8bea4da32aecb21a053a929198387c7722049bb8356e6b353da85
tests/images/from_unstructured__tri_hammer.png 5105b32b3d52fe35e39f41e41645120b3b8021db3d144825f2214b909d71026e
tests/images/from_unstructured__tri.png 327027e93d74e202d0fd31f03b47de4f4c9e7870dbed8ac84b5aecd5760ddf95
tests/images/vectors.png fdfea84491039fa742b73e610b834272d73eac7a70ab6b8c6e9b51019c0e1a95
tos_Omon_AWI-ESM-1-1-LR_historical_r1i1p1f1_gn_185001-185012.nc 28a8f7b8f3d8edded39a7b9c93afe54aeefbf271086927c7f684207327acc882
Binary file removed tests/plotting/image_cache/clouds.png
Binary file not shown.
Binary file removed tests/plotting/image_cache/clouds_robin.png
Binary file not shown.
Binary file removed tests/plotting/image_cache/earthquakes.png
Binary file not shown.
Binary file removed tests/plotting/image_cache/earthquakes_wink1.png
Binary file not shown.
Binary file removed tests/plotting/image_cache/from_1d__oisst.png
Binary file not shown.
Binary file removed tests/plotting/image_cache/from_1d__oisst_eqc.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed tests/plotting/image_cache/from_2d__orca.png
Binary file not shown.
Binary file removed tests/plotting/image_cache/from_2d__orca_moll.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed tests/plotting/image_cache/vectors.png
Diff not rendered.
26 changes: 23 additions & 3 deletions tests/plotting/test_examples.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
"""Unit-tests for :mod:`geovista.examples`."""
import importlib
import os
from pathlib import Path
import pkgutil
import shutil

import pytest
import pyvista as pv

import geovista as gv
from geovista.cache import CACHE
import geovista.examples

# determine whether running on GHA runner
# determine whether executing on a GHA runner
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
CI: bool = os.environ.get("CI", "false").lower() == "true"


# construct list of example script names
SCRIPTS = sorted(
[submodule.name for submodule in pkgutil.iter_modules(gv.examples.__path__)]
)

# prepare geovista/pyvista for off-screen image testing
pv.global_theme.load_theme(pv.plotting.themes._TestingTheme())
pv.OFF_SCREEN = True
gv.GEOVISTA_IMAGE_TESTING = True

# individual test case exceptions to the default image tolerances
# prepare to download image cache for each image test
# also see reference in pyproject.toml
cache_dir = Path(__file__).parent.resolve() / "image_cache"
if cache_dir.is_dir() and not cache_dir.is_symlink():
# remove directory which will have been created by pytest-pyvista
# when plugin is bootstrapped by pytest
shutil.rmtree(str(cache_dir))
if not cache_dir.exists():
# create the symbolic link to the pooch cache
cache_dir.symlink_to(CACHE.abspath / "tests" / "images")

# individual GHA CI test case exceptions to the default image tolerances
thresholds = {
"from_points__orca_cloud": {"warning_value": 202.0},
"from_points__orca_cloud_eqc": {"warning_value": 250.0},
Expand All @@ -39,6 +53,12 @@ def test(script, verify_image_cache):
if CI and script in thresholds:
for attr, value in thresholds[script].items():
setattr(verify_image_cache, attr, value)

verify_image_cache.test_name = f"test_{script}"
# import the example script
module = importlib.import_module(f"geovista.examples.{script}")
# if necessary, download and cache missing script base image (expected) to
# compare with the actual test image generated via pytest-pyvista plugin
_ = CACHE.fetch(f"tests/images/{script}.png")
# execute the example script for image testing
module.main()
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ setenv =
usedevelop =
true
commands =
mkdir --parents {toxinidir}/test_images
pytest {posargs} --fail_extra_image_cache --generated_image_dir {toxinidir}{/}test_images
{env:POST_COMMAND:}

Expand Down

0 comments on commit 7d204d2

Please sign in to comment.