python-cartopy/0001-Increase-tolerance-for-new-FreeType.patch
2022-09-16 00:12:31 -04:00

170 lines
7.3 KiB
Diff

From 3cd4152ba8a7ec7f089fdb912cff92fbd55ecedb Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 26 Feb 2018 02:42:50 -0500
Subject: [PATCH 1/4] Increase tolerance for new FreeType.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/cartopy/tests/mpl/test_crs.py | 4 ++--
lib/cartopy/tests/mpl/test_examples.py | 4 +---
lib/cartopy/tests/mpl/test_gridliner.py | 11 +++++++----
lib/cartopy/tests/mpl/test_mpl_integration.py | 2 +-
lib/cartopy/tests/mpl/test_ticks.py | 14 +++++++++-----
5 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/lib/cartopy/tests/mpl/test_crs.py b/lib/cartopy/tests/mpl/test_crs.py
index 7c8580a5..40321df8 100644
--- a/lib/cartopy/tests/mpl/test_crs.py
+++ b/lib/cartopy/tests/mpl/test_crs.py
@@ -14,7 +14,7 @@ from cartopy.tests.mpl import MPL_VERSION
@pytest.mark.natural_earth
@pytest.mark.mpl_image_compare(filename="igh_land.png",
tolerance=(3.6
- if MPL_VERSION.release[:2] < (3, 5)
+ if MPL_VERSION.release[:2] < (3, 6)
else 0.5))
def test_igh_land():
crs = ccrs.InterruptedGoodeHomolosine(emphasis="land")
@@ -27,7 +27,7 @@ def test_igh_land():
@pytest.mark.natural_earth
@pytest.mark.mpl_image_compare(filename="igh_ocean.png",
tolerance=(4.5
- if MPL_VERSION.release[:2] < (3, 5)
+ if MPL_VERSION.release[:2] < (3, 6)
else 0.5))
def test_igh_ocean():
crs = ccrs.InterruptedGoodeHomolosine(
diff --git a/lib/cartopy/tests/mpl/test_examples.py b/lib/cartopy/tests/mpl/test_examples.py
index c678cc59..32bff3d4 100644
--- a/lib/cartopy/tests/mpl/test_examples.py
+++ b/lib/cartopy/tests/mpl/test_examples.py
@@ -33,9 +33,7 @@ def test_global_map():
@pytest.mark.natural_earth
@pytest.mark.mpl_image_compare(filename='contour_label.png',
- tolerance=(9.9
- if MPL_VERSION.release[:2] < (3, 3)
- else 0.5))
+ tolerance=10.4)
def test_contour_label():
from cartopy.tests.mpl.test_caching import sample_data
fig = plt.figure()
diff --git a/lib/cartopy/tests/mpl/test_gridliner.py b/lib/cartopy/tests/mpl/test_gridliner.py
index ba1614f9..918dd4f0 100644
--- a/lib/cartopy/tests/mpl/test_gridliner.py
+++ b/lib/cartopy/tests/mpl/test_gridliner.py
@@ -127,6 +127,9 @@ def test_gridliner_specified_lines():
# of text objects. A new testing strategy is needed for this kind of test.
grid_label_tol = 3.9
+# Force higher tolerance due to new FreeType on Fedora.
+grid_label_tol = 15.2
+
@pytest.mark.skipif(geos_version == (3, 9, 0), reason="GEOS intersection bug")
@pytest.mark.natural_earth
@@ -208,7 +211,7 @@ def test_grid_labels():
@pytest.mark.skipif(geos_version == (3, 9, 0), reason="GEOS intersection bug")
@pytest.mark.natural_earth
@pytest.mark.mpl_image_compare(filename='gridliner_labels_tight.png',
- tolerance=2.92)
+ tolerance=47.1)
def test_grid_labels_tight():
# Ensure tight layout accounts for gridlines
fig = plt.figure(figsize=(7, 5))
@@ -252,7 +255,7 @@ def test_grid_labels_tight():
@pytest.mark.skipif(geos_version == (3, 9, 0), reason="GEOS intersection bug")
@pytest.mark.natural_earth
@pytest.mark.parametrize('proj', TEST_PROJS)
-@pytest.mark.mpl_image_compare(style='mpl20')
+@pytest.mark.mpl_image_compare(style='mpl20', tolerance=8.36)
def test_grid_labels_inline(proj):
fig = plt.figure()
if isinstance(proj, tuple):
@@ -268,7 +271,7 @@ def test_grid_labels_inline(proj):
@pytest.mark.skipif(geos_version == (3, 9, 0), reason="GEOS intersection bug")
@pytest.mark.natural_earth
@pytest.mark.parametrize('proj', TEST_PROJS)
-@pytest.mark.mpl_image_compare(style='mpl20', tolerance=0.79)
+@pytest.mark.mpl_image_compare(style='mpl20', tolerance=7.76)
def test_grid_labels_inline_usa(proj):
top = 49.3457868 # north lat
left = -124.7844079 # west long
@@ -292,7 +295,7 @@ def test_grid_labels_inline_usa(proj):
@pytest.mark.skipif(geos_version == (3, 9, 0), reason="GEOS intersection bug")
@pytest.mark.mpl_image_compare(filename='gridliner_labels_bbox_style.png',
- tolerance=grid_label_tol)
+ tolerance=41.5)
def test_gridliner_labels_bbox_style():
top = 49.3457868 # north lat
left = -124.7844079 # west long
diff --git a/lib/cartopy/tests/mpl/test_mpl_integration.py b/lib/cartopy/tests/mpl/test_mpl_integration.py
index 884a950f..4740f796 100644
--- a/lib/cartopy/tests/mpl/test_mpl_integration.py
+++ b/lib/cartopy/tests/mpl/test_mpl_integration.py
@@ -859,7 +859,7 @@ def test_streamplot():
@pytest.mark.natural_earth
-@pytest.mark.mpl_image_compare()
+@pytest.mark.mpl_image_compare(tolerance=3.95)
def test_annotate():
""" test a variety of annotate options on mulitple projections
diff --git a/lib/cartopy/tests/mpl/test_ticks.py b/lib/cartopy/tests/mpl/test_ticks.py
index d629ccd7..fcf72164 100644
--- a/lib/cartopy/tests/mpl/test_ticks.py
+++ b/lib/cartopy/tests/mpl/test_ticks.py
@@ -11,7 +11,8 @@ from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
@pytest.mark.natural_earth
-@pytest.mark.mpl_image_compare(filename='xticks_no_transform.png')
+@pytest.mark.mpl_image_compare(filename='xticks_no_transform.png',
+ tolerance=6.71)
def test_set_xticks_no_transform():
ax = plt.axes(projection=ccrs.PlateCarree())
ax.coastlines('110m')
@@ -22,7 +23,8 @@ def test_set_xticks_no_transform():
@pytest.mark.natural_earth
-@pytest.mark.mpl_image_compare(filename='xticks_cylindrical.png')
+@pytest.mark.mpl_image_compare(filename='xticks_cylindrical.png',
+ tolerance=7.13)
def test_set_xticks_cylindrical():
ax = plt.axes(projection=ccrs.Mercator(min_latitude=-85, max_latitude=85))
ax.coastlines('110m')
@@ -41,7 +43,8 @@ def test_set_xticks_non_cylindrical():
@pytest.mark.natural_earth
-@pytest.mark.mpl_image_compare(filename='yticks_no_transform.png')
+@pytest.mark.mpl_image_compare(filename='yticks_no_transform.png',
+ tolerance=3.75)
def test_set_yticks_no_transform():
ax = plt.axes(projection=ccrs.PlateCarree())
ax.coastlines('110m')
@@ -52,7 +55,8 @@ def test_set_yticks_no_transform():
@pytest.mark.natural_earth
-@pytest.mark.mpl_image_compare(filename='yticks_cylindrical.png')
+@pytest.mark.mpl_image_compare(filename='yticks_cylindrical.png',
+ tolerance=4.37)
def test_set_yticks_cylindrical():
ax = plt.axes(projection=ccrs.Mercator(min_latitude=-85, max_latitude=85))
ax.coastlines('110m')
@@ -73,7 +77,7 @@ def test_set_yticks_non_cylindrical():
@pytest.mark.natural_earth
-@pytest.mark.mpl_image_compare(filename='xyticks.png')
+@pytest.mark.mpl_image_compare(filename='xyticks.png', tolerance=7.19)
def test_set_xyticks():
fig = plt.figure(figsize=(10, 10))
projections = (ccrs.PlateCarree(),
--
2.36.1