Skip to content

Commit

Permalink
apply gha image tolerance deltas
Browse files Browse the repository at this point in the history
  • Loading branch information
bjlittle committed Oct 12, 2023
1 parent ab6f2a7 commit cb833b7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/plotting/test_examples.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Unit-tests for :mod:`geovista.examples`."""
import importlib
import os
import pkgutil

import pytest
Expand All @@ -8,6 +9,9 @@
import geovista as gv
import geovista.examples

# determine whether running on GHA runner
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__)]
Expand All @@ -17,11 +21,22 @@
pv.OFF_SCREEN = True
gv.GEOVISTA_IMAGE_TESTING = True

# individual 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},
}


@pytest.mark.image
@pytest.mark.parametrize("script", SCRIPTS)
def test(script, verify_image_cache):
"""Image test the example scripts."""
# apply individual test case image tolerance exceptions only when
# executing within a remote GHA runner environment
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}"
module = importlib.import_module(f"geovista.examples.{script}")
module.main()

0 comments on commit cb833b7

Please sign in to comment.