From cb833b7ec6e8d58ac02eabad41d82c3f1c59ae34 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Thu, 12 Oct 2023 18:08:17 +0100 Subject: [PATCH] apply gha image tolerance deltas --- tests/plotting/test_examples.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/plotting/test_examples.py b/tests/plotting/test_examples.py index 6edbe272..fbd3f8fc 100644 --- a/tests/plotting/test_examples.py +++ b/tests/plotting/test_examples.py @@ -1,5 +1,6 @@ """Unit-tests for :mod:`geovista.examples`.""" import importlib +import os import pkgutil import pytest @@ -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__)] @@ -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()